mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Energy settings
This commit is contained in:
parent
bb7ffa6191
commit
b324029366
@ -744,7 +744,7 @@ public protocol SharedAccountContext: AnyObject {
|
|||||||
var currentPresentationData: Atomic<PresentationData> { get }
|
var currentPresentationData: Atomic<PresentationData> { get }
|
||||||
var presentationData: Signal<PresentationData, NoError> { get }
|
var presentationData: Signal<PresentationData, NoError> { get }
|
||||||
|
|
||||||
var currentAutomaticMediaDownloadSettings: Atomic<MediaAutoDownloadSettings> { get }
|
var currentAutomaticMediaDownloadSettings: MediaAutoDownloadSettings { get }
|
||||||
var automaticMediaDownloadSettings: Signal<MediaAutoDownloadSettings, NoError> { get }
|
var automaticMediaDownloadSettings: Signal<MediaAutoDownloadSettings, NoError> { get }
|
||||||
var currentAutodownloadSettings: Atomic<AutodownloadSettings> { get }
|
var currentAutodownloadSettings: Atomic<AutodownloadSettings> { get }
|
||||||
var immediateExperimentalUISettings: ExperimentalUISettings { get }
|
var immediateExperimentalUISettings: ExperimentalUISettings { get }
|
||||||
|
@ -31,8 +31,8 @@ private struct ArchivedStickersNoticeEntry: Comparable, Identifiable {
|
|||||||
return lhs.index < rhs.index
|
return lhs.index < rhs.index
|
||||||
}
|
}
|
||||||
|
|
||||||
func item(account: Account, presentationData: PresentationData) -> ListViewItem {
|
func item(context: AccountContext, presentationData: PresentationData) -> ListViewItem {
|
||||||
return ItemListStickerPackItem(presentationData: ItemListPresentationData(presentationData), account: account, packInfo: info, itemCount: self.count, topItem: topItem, unread: false, control: .none, editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false, selectable: false), enabled: true, playAnimatedStickers: true, sectionId: 0, action: {
|
return ItemListStickerPackItem(presentationData: ItemListPresentationData(presentationData), context: context, packInfo: info, itemCount: self.count, topItem: topItem, unread: false, control: .none, editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false, selectable: false), enabled: true, playAnimatedStickers: true, sectionId: 0, action: {
|
||||||
}, setPackIdWithRevealedOptions: { current, previous in
|
}, setPackIdWithRevealedOptions: { current, previous in
|
||||||
}, addPack: {
|
}, addPack: {
|
||||||
}, removePack: {
|
}, removePack: {
|
||||||
@ -47,12 +47,12 @@ private struct ArchivedStickersNoticeTransition {
|
|||||||
let updates: [ListViewUpdateItem]
|
let updates: [ListViewUpdateItem]
|
||||||
}
|
}
|
||||||
|
|
||||||
private func preparedTransition(from fromEntries: [ArchivedStickersNoticeEntry], to toEntries: [ArchivedStickersNoticeEntry], account: Account, presentationData: PresentationData) -> ArchivedStickersNoticeTransition {
|
private func preparedTransition(from fromEntries: [ArchivedStickersNoticeEntry], to toEntries: [ArchivedStickersNoticeEntry], context: AccountContext, presentationData: PresentationData) -> ArchivedStickersNoticeTransition {
|
||||||
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
|
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
|
||||||
|
|
||||||
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
|
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
|
||||||
let insertions = indicesAndItems.map { ListViewInsertItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(account: account, presentationData: presentationData), directionHint: nil) }
|
let insertions = indicesAndItems.map { ListViewInsertItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(context: context, presentationData: presentationData), directionHint: nil) }
|
||||||
let updates = updateIndices.map { ListViewUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(account: account, presentationData: presentationData), directionHint: nil) }
|
let updates = updateIndices.map { ListViewUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(context: context, presentationData: presentationData), directionHint: nil) }
|
||||||
|
|
||||||
return ArchivedStickersNoticeTransition(deletions: deletions, insertions: insertions, updates: updates)
|
return ArchivedStickersNoticeTransition(deletions: deletions, insertions: insertions, updates: updates)
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ private final class ArchivedStickersNoticeAlertContentNode: AlertContentNode {
|
|||||||
return self.isUserInteractionEnabled
|
return self.isUserInteractionEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
init(theme: AlertControllerTheme, account: Account, presentationData: PresentationData, archivedStickerPacks: [(StickerPackCollectionInfo, StickerPackItem?)], actions: [TextAlertAction]) {
|
init(theme: AlertControllerTheme, context: AccountContext, presentationData: PresentationData, archivedStickerPacks: [(StickerPackCollectionInfo, StickerPackItem?)], actions: [TextAlertAction]) {
|
||||||
self.presentationData = presentationData
|
self.presentationData = presentationData
|
||||||
self.archivedStickerPacks = archivedStickerPacks
|
self.archivedStickerPacks = archivedStickerPacks
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ private final class ArchivedStickersNoticeAlertContentNode: AlertContentNode {
|
|||||||
index += 1
|
index += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
let transition = preparedTransition(from: [], to: entries, account: account, presentationData: presentationData)
|
let transition = preparedTransition(from: [], to: entries, context: context, presentationData: presentationData)
|
||||||
self.enqueueTransition(transition)
|
self.enqueueTransition(transition)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ public func archivedStickerPacksNoticeController(context: AccountContext, archiv
|
|||||||
|
|
||||||
let disposable = MetaDisposable()
|
let disposable = MetaDisposable()
|
||||||
|
|
||||||
let contentNode = ArchivedStickersNoticeAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), account: context.account, presentationData: presentationData, archivedStickerPacks: archivedStickerPacks, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {
|
let contentNode = ArchivedStickersNoticeAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), context: context, presentationData: presentationData, archivedStickerPacks: archivedStickerPacks, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {
|
||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
})])
|
})])
|
||||||
|
|
||||||
|
@ -1318,7 +1318,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
|
|
||||||
if isKnown {
|
if isKnown {
|
||||||
let photo = personalPhoto ?? profilePhoto
|
let photo = personalPhoto ?? profilePhoto
|
||||||
if let photo = photo, !photo.videoRepresentations.isEmpty || photo.emojiMarkup != nil {
|
if let photo = photo, item.context.sharedContext.energyUsageSettings.loopEmoji, (!photo.videoRepresentations.isEmpty || photo.emojiMarkup != nil) {
|
||||||
let videoNode: AvatarVideoNode
|
let videoNode: AvatarVideoNode
|
||||||
if let current = strongSelf.avatarVideoNode {
|
if let current = strongSelf.avatarVideoNode {
|
||||||
videoNode = current
|
videoNode = current
|
||||||
|
@ -14,10 +14,6 @@ public enum DeviceMetrics: CaseIterable, Equatable {
|
|||||||
var cpuCount: UInt32 = 0
|
var cpuCount: UInt32 = 0
|
||||||
sysctlbyname("hw.ncpu", &cpuCount, &length, nil, 0)
|
sysctlbyname("hw.ncpu", &cpuCount, &length, nil, 0)
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
cpuCount = 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
self.isGraphicallyCapable = cpuCount >= 6
|
self.isGraphicallyCapable = cpuCount >= 6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ final class TrendingTopItemNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let placeholderNode = self.placeholderNode, let file = self.file {
|
if let placeholderNode = self.placeholderNode, let file = self.file {
|
||||||
placeholderNode.update(backgroundColor: backgroundColor, foregroundColor: foregroundColor, shimmeringColor: shimmeringColor, data: file.immediateThumbnailData, size: self.itemSize ?? CGSize(width: 75.0, height: 75.0))
|
placeholderNode.update(backgroundColor: backgroundColor, foregroundColor: foregroundColor, shimmeringColor: shimmeringColor, data: file.immediateThumbnailData, size: self.itemSize ?? CGSize(width: 75.0, height: 75.0), enableEffect: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ final class InstantPageImageNode: ASDisplayNode, InstantPageNode {
|
|||||||
let imageReference = ImageMediaReference.webPage(webPage: WebpageReference(webPage), media: image)
|
let imageReference = ImageMediaReference.webPage(webPage: WebpageReference(webPage), media: image)
|
||||||
self.imageNode.setSignal(chatMessagePhoto(postbox: context.account.postbox, userLocation: sourceLocation.userLocation, photoReference: imageReference))
|
self.imageNode.setSignal(chatMessagePhoto(postbox: context.account.postbox, userLocation: sourceLocation.userLocation, photoReference: imageReference))
|
||||||
|
|
||||||
if !interactive || shouldDownloadMediaAutomatically(settings: context.sharedContext.currentAutomaticMediaDownloadSettings.with { $0 }, peerType: sourceLocation.peerType, networkType: MediaAutoDownloadNetworkType(context.account.immediateNetworkType), authorPeerId: nil, contactsPeerIds: Set(), media: image) {
|
if !interactive || shouldDownloadMediaAutomatically(settings: context.sharedContext.currentAutomaticMediaDownloadSettings, peerType: sourceLocation.peerType, networkType: MediaAutoDownloadNetworkType(context.account.immediateNetworkType), authorPeerId: nil, contactsPeerIds: Set(), media: image) {
|
||||||
self.fetchedDisposable.set(chatMessagePhotoInteractiveFetched(context: context, userLocation: sourceLocation.userLocation, photoReference: imageReference, displayAtSize: nil, storeToDownloadsPeerId: nil).start())
|
self.fetchedDisposable.set(chatMessagePhotoInteractiveFetched(context: context, userLocation: sourceLocation.userLocation, photoReference: imageReference, displayAtSize: nil, storeToDownloadsPeerId: nil).start())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ final class InstantPageImageNode: ASDisplayNode, InstantPageNode {
|
|||||||
} else if let file = media.media as? TelegramMediaFile {
|
} else if let file = media.media as? TelegramMediaFile {
|
||||||
let fileReference = FileMediaReference.webPage(webPage: WebpageReference(webPage), media: file)
|
let fileReference = FileMediaReference.webPage(webPage: WebpageReference(webPage), media: file)
|
||||||
if file.mimeType.hasPrefix("image/") {
|
if file.mimeType.hasPrefix("image/") {
|
||||||
if !interactive || shouldDownloadMediaAutomatically(settings: context.sharedContext.currentAutomaticMediaDownloadSettings.with { $0 }, peerType: sourceLocation.peerType, networkType: MediaAutoDownloadNetworkType(context.account.immediateNetworkType), authorPeerId: nil, contactsPeerIds: Set(), media: file) {
|
if !interactive || shouldDownloadMediaAutomatically(settings: context.sharedContext.currentAutomaticMediaDownloadSettings, peerType: sourceLocation.peerType, networkType: MediaAutoDownloadNetworkType(context.account.immediateNetworkType), authorPeerId: nil, contactsPeerIds: Set(), media: file) {
|
||||||
_ = freeMediaFileInteractiveFetched(account: context.account, userLocation: sourceLocation.userLocation, fileReference: fileReference).start()
|
_ = freeMediaFileInteractiveFetched(account: context.account, userLocation: sourceLocation.userLocation, fileReference: fileReference).start()
|
||||||
}
|
}
|
||||||
self.imageNode.setSignal(instantPageImageFile(account: context.account, userLocation: sourceLocation.userLocation, fileReference: fileReference, fetched: true))
|
self.imageNode.setSignal(instantPageImageFile(account: context.account, userLocation: sourceLocation.userLocation, fileReference: fileReference, fetched: true))
|
||||||
|
@ -12,6 +12,7 @@ import StickerResources
|
|||||||
import AnimatedStickerNode
|
import AnimatedStickerNode
|
||||||
import TelegramAnimatedStickerNode
|
import TelegramAnimatedStickerNode
|
||||||
import ShimmerEffect
|
import ShimmerEffect
|
||||||
|
import AccountContext
|
||||||
|
|
||||||
public struct ItemListStickerPackItemEditing: Equatable {
|
public struct ItemListStickerPackItemEditing: Equatable {
|
||||||
public var editable: Bool
|
public var editable: Bool
|
||||||
@ -38,7 +39,7 @@ public enum ItemListStickerPackItemControl: Equatable {
|
|||||||
|
|
||||||
public final class ItemListStickerPackItem: ListViewItem, ItemListItem {
|
public final class ItemListStickerPackItem: ListViewItem, ItemListItem {
|
||||||
let presentationData: ItemListPresentationData
|
let presentationData: ItemListPresentationData
|
||||||
let account: Account
|
let context: AccountContext
|
||||||
let packInfo: StickerPackCollectionInfo
|
let packInfo: StickerPackCollectionInfo
|
||||||
let itemCount: String
|
let itemCount: String
|
||||||
let topItem: StickerPackItem?
|
let topItem: StickerPackItem?
|
||||||
@ -54,9 +55,9 @@ public final class ItemListStickerPackItem: ListViewItem, ItemListItem {
|
|||||||
let removePack: () -> Void
|
let removePack: () -> Void
|
||||||
let toggleSelected: () -> Void
|
let toggleSelected: () -> Void
|
||||||
|
|
||||||
public init(presentationData: ItemListPresentationData, account: Account, packInfo: StickerPackCollectionInfo, itemCount: String, topItem: StickerPackItem?, unread: Bool, control: ItemListStickerPackItemControl, editing: ItemListStickerPackItemEditing, enabled: Bool, playAnimatedStickers: Bool, sectionId: ItemListSectionId, action: (() -> Void)?, setPackIdWithRevealedOptions: @escaping (ItemCollectionId?, ItemCollectionId?) -> Void, addPack: @escaping () -> Void, removePack: @escaping () -> Void, toggleSelected: @escaping () -> Void) {
|
public init(presentationData: ItemListPresentationData, context: AccountContext, packInfo: StickerPackCollectionInfo, itemCount: String, topItem: StickerPackItem?, unread: Bool, control: ItemListStickerPackItemControl, editing: ItemListStickerPackItemEditing, enabled: Bool, playAnimatedStickers: Bool, sectionId: ItemListSectionId, action: (() -> Void)?, setPackIdWithRevealedOptions: @escaping (ItemCollectionId?, ItemCollectionId?) -> Void, addPack: @escaping () -> Void, removePack: @escaping () -> Void, toggleSelected: @escaping () -> Void) {
|
||||||
self.presentationData = presentationData
|
self.presentationData = presentationData
|
||||||
self.account = account
|
self.context = context
|
||||||
self.packInfo = packInfo
|
self.packInfo = packInfo
|
||||||
self.itemCount = itemCount
|
self.itemCount = itemCount
|
||||||
self.topItem = topItem
|
self.topItem = topItem
|
||||||
@ -506,18 +507,18 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
|
|||||||
|
|
||||||
if fileUpdated {
|
if fileUpdated {
|
||||||
imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: stillImageSize, boundingSize: stillImageSize, intrinsicInsets: UIEdgeInsets()))
|
imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: stillImageSize, boundingSize: stillImageSize, intrinsicInsets: UIEdgeInsets()))
|
||||||
updatedImageSignal = chatMessageStickerPackThumbnail(postbox: item.account.postbox, resource: representation.resource, nilIfEmpty: true)
|
updatedImageSignal = chatMessageStickerPackThumbnail(postbox: item.context.account.postbox, resource: representation.resource, nilIfEmpty: true)
|
||||||
}
|
}
|
||||||
case let .animated(resource, dimensions, _):
|
case let .animated(resource, dimensions, _):
|
||||||
imageSize = dimensions.cgSize.aspectFitted(imageBoundingSize)
|
imageSize = dimensions.cgSize.aspectFitted(imageBoundingSize)
|
||||||
|
|
||||||
if fileUpdated {
|
if fileUpdated {
|
||||||
imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: imageBoundingSize, boundingSize: imageBoundingSize, intrinsicInsets: UIEdgeInsets()))
|
imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: imageBoundingSize, boundingSize: imageBoundingSize, intrinsicInsets: UIEdgeInsets()))
|
||||||
updatedImageSignal = chatMessageStickerPackThumbnail(postbox: item.account.postbox, resource: resource, animated: true, nilIfEmpty: true)
|
updatedImageSignal = chatMessageStickerPackThumbnail(postbox: item.context.account.postbox, resource: resource, animated: true, nilIfEmpty: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if fileUpdated, let resourceReference = resourceReference {
|
if fileUpdated, let resourceReference = resourceReference {
|
||||||
updatedFetchSignal = fetchedMediaResource(mediaBox: item.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: resourceReference)
|
updatedFetchSignal = fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: resourceReference)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updatedImageSignal = .single({ _ in return nil })
|
updatedImageSignal = .single({ _ in return nil })
|
||||||
@ -768,7 +769,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
|
|||||||
strongSelf.animationNode = animationNode
|
strongSelf.animationNode = animationNode
|
||||||
strongSelf.addSubnode(animationNode)
|
strongSelf.addSubnode(animationNode)
|
||||||
|
|
||||||
animationNode.setup(source: AnimatedStickerResourceSource(account: item.account, resource: resource, isVideo: isVideo), width: 80, height: 80, playbackMode: .loop, mode: .direct(cachePathPrefix: nil))
|
animationNode.setup(source: AnimatedStickerResourceSource(account: item.context.account, resource: resource, isVideo: isVideo), width: 80, height: 80, playbackMode: .loop, mode: .direct(cachePathPrefix: nil))
|
||||||
}
|
}
|
||||||
animationNode.visibility = strongSelf.visibility != .none && item.playAnimatedStickers
|
animationNode.visibility = strongSelf.visibility != .none && item.playAnimatedStickers
|
||||||
animationNode.isHidden = !item.playAnimatedStickers
|
animationNode.isHidden = !item.playAnimatedStickers
|
||||||
@ -794,7 +795,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
|
|||||||
|
|
||||||
placeholderNode.frame = imageFrame
|
placeholderNode.frame = imageFrame
|
||||||
|
|
||||||
placeholderNode.update(backgroundColor: nil, foregroundColor: item.presentationData.theme.list.disclosureArrowColor.blitOver(item.presentationData.theme.list.itemBlocksBackgroundColor, alpha: 0.55), shimmeringColor: item.presentationData.theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.4), data: immediateThumbnailData, size: imageFrame.size, imageSize: imageSize.cgSize)
|
placeholderNode.update(backgroundColor: nil, foregroundColor: item.presentationData.theme.list.disclosureArrowColor.blitOver(item.presentationData.theme.list.itemBlocksBackgroundColor, alpha: 0.55), shimmeringColor: item.presentationData.theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.4), data: immediateThumbnailData, size: imageFrame.size, enableEffect: item.context.sharedContext.energyUsageSettings.fullTranslucency, imageSize: imageSize.cgSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let updatedImageSignal = updatedImageSignal {
|
if let updatedImageSignal = updatedImageSignal {
|
||||||
|
@ -13,15 +13,15 @@ import StickerPackPreviewUI
|
|||||||
import ItemListStickerPackItem
|
import ItemListStickerPackItem
|
||||||
|
|
||||||
private final class GroupStickerPackSetupControllerArguments {
|
private final class GroupStickerPackSetupControllerArguments {
|
||||||
let account: Account
|
let context: AccountContext
|
||||||
|
|
||||||
let selectStickerPack: (StickerPackCollectionInfo) -> Void
|
let selectStickerPack: (StickerPackCollectionInfo) -> Void
|
||||||
let openStickerPack: (StickerPackCollectionInfo) -> Void
|
let openStickerPack: (StickerPackCollectionInfo) -> Void
|
||||||
let updateSearchText: (String) -> Void
|
let updateSearchText: (String) -> Void
|
||||||
let openStickersBot: () -> Void
|
let openStickersBot: () -> Void
|
||||||
|
|
||||||
init(account: Account, selectStickerPack: @escaping (StickerPackCollectionInfo) -> Void, openStickerPack: @escaping (StickerPackCollectionInfo) -> Void, updateSearchText: @escaping (String) -> Void, openStickersBot: @escaping () -> Void) {
|
init(context: AccountContext, selectStickerPack: @escaping (StickerPackCollectionInfo) -> Void, openStickerPack: @escaping (StickerPackCollectionInfo) -> Void, updateSearchText: @escaping (String) -> Void, openStickersBot: @escaping () -> Void) {
|
||||||
self.account = account
|
self.context = context
|
||||||
self.selectStickerPack = selectStickerPack
|
self.selectStickerPack = selectStickerPack
|
||||||
self.openStickerPack = openStickerPack
|
self.openStickerPack = openStickerPack
|
||||||
self.updateSearchText = updateSearchText
|
self.updateSearchText = updateSearchText
|
||||||
@ -218,7 +218,7 @@ private enum GroupStickerPackEntry: ItemListNodeEntry {
|
|||||||
case let .packsTitle(_, text):
|
case let .packsTitle(_, text):
|
||||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||||
case let .pack(_, _, _, info, topItem, count, playAnimatedStickers, selected):
|
case let .pack(_, _, _, info, topItem, count, playAnimatedStickers, selected):
|
||||||
return ItemListStickerPackItem(presentationData: presentationData, account: arguments.account, packInfo: info, itemCount: count, topItem: topItem, unread: false, control: selected ? .selection : .none, editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false, selectable: false), enabled: true, playAnimatedStickers: playAnimatedStickers, sectionId: self.section, action: {
|
return ItemListStickerPackItem(presentationData: presentationData, context: arguments.context, packInfo: info, itemCount: count, topItem: topItem, unread: false, control: selected ? .selection : .none, editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false, selectable: false), enabled: true, playAnimatedStickers: playAnimatedStickers, sectionId: self.section, action: {
|
||||||
if selected {
|
if selected {
|
||||||
arguments.openStickerPack(info)
|
arguments.openStickerPack(info)
|
||||||
} else {
|
} else {
|
||||||
@ -230,7 +230,7 @@ private enum GroupStickerPackEntry: ItemListNodeEntry {
|
|||||||
}, toggleSelected: {
|
}, toggleSelected: {
|
||||||
})
|
})
|
||||||
case let .currentPack(_, theme, strings, content):
|
case let .currentPack(_, theme, strings, content):
|
||||||
return GroupStickerPackCurrentItem(theme: theme, strings: strings, account: arguments.account, content: content, sectionId: self.section, action: {
|
return GroupStickerPackCurrentItem(theme: theme, strings: strings, account: arguments.context.account, content: content, sectionId: self.section, action: {
|
||||||
if case let .found(packInfo, _, _) = content {
|
if case let .found(packInfo, _, _) = content {
|
||||||
arguments.openStickerPack(packInfo)
|
arguments.openStickerPack(packInfo)
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@ public func groupStickerPackSetupController(context: AccountContext, updatedPres
|
|||||||
|
|
||||||
var presentStickerPackController: ((StickerPackCollectionInfo) -> Void)?
|
var presentStickerPackController: ((StickerPackCollectionInfo) -> Void)?
|
||||||
|
|
||||||
let arguments = GroupStickerPackSetupControllerArguments(account: context.account, selectStickerPack: { info in
|
let arguments = GroupStickerPackSetupControllerArguments(context: context, selectStickerPack: { info in
|
||||||
searchText.set(info.shortName)
|
searchText.set(info.shortName)
|
||||||
}, openStickerPack: { info in
|
}, openStickerPack: { info in
|
||||||
presentStickerPackController?(info)
|
presentStickerPackController?(info)
|
||||||
|
@ -268,7 +268,7 @@ private class StickerNode: ASDisplayNode {
|
|||||||
if self.placeholderNode.supernode != nil {
|
if self.placeholderNode.supernode != nil {
|
||||||
let placeholderFrame = CGRect(origin: CGPoint(x: -10.0, y: 0.0), size: imageSize)
|
let placeholderFrame = CGRect(origin: CGPoint(x: -10.0, y: 0.0), size: imageSize)
|
||||||
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
||||||
self.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: self.file.immediateThumbnailData, size: placeholderFrame.size, imageSize: thumbnailDimensions.cgSize)
|
self.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: self.file.immediateThumbnailData, size: placeholderFrame.size, enableEffect: true, imageSize: thumbnailDimensions.cgSize)
|
||||||
self.placeholderNode.frame = placeholderFrame
|
self.placeholderNode.frame = placeholderFrame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ private enum DataAndStorageEntry: ItemListNodeEntry {
|
|||||||
}, tag: DataAndStorageEntryTag.autoplayVideos)
|
}, tag: DataAndStorageEntryTag.autoplayVideos)
|
||||||
case .energySaving:
|
case .energySaving:
|
||||||
//TODO:localize
|
//TODO:localize
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: "Energy Settings", label: "", sectionId: self.section, style: .blocks, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: "Energy Saving", label: "", sectionId: self.section, style: .blocks, action: {
|
||||||
arguments.openEnergySavingSettings()
|
arguments.openEnergySavingSettings()
|
||||||
})
|
})
|
||||||
case let .useLessVoiceData(_, text, value):
|
case let .useLessVoiceData(_, text, value):
|
||||||
|
@ -21,15 +21,15 @@ public enum ArchivedStickerPacksControllerMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class ArchivedStickerPacksControllerArguments {
|
private final class ArchivedStickerPacksControllerArguments {
|
||||||
let account: Account
|
let context: AccountContext
|
||||||
|
|
||||||
let openStickerPack: (StickerPackCollectionInfo) -> Void
|
let openStickerPack: (StickerPackCollectionInfo) -> Void
|
||||||
let setPackIdWithRevealedOptions: (ItemCollectionId?, ItemCollectionId?) -> Void
|
let setPackIdWithRevealedOptions: (ItemCollectionId?, ItemCollectionId?) -> Void
|
||||||
let addPack: (StickerPackCollectionInfo) -> Void
|
let addPack: (StickerPackCollectionInfo) -> Void
|
||||||
let removePack: (StickerPackCollectionInfo) -> Void
|
let removePack: (StickerPackCollectionInfo) -> Void
|
||||||
|
|
||||||
init(account: Account, openStickerPack: @escaping (StickerPackCollectionInfo) -> Void, setPackIdWithRevealedOptions: @escaping (ItemCollectionId?, ItemCollectionId?) -> Void, addPack: @escaping (StickerPackCollectionInfo) -> Void, removePack: @escaping (StickerPackCollectionInfo) -> Void) {
|
init(context: AccountContext, openStickerPack: @escaping (StickerPackCollectionInfo) -> Void, setPackIdWithRevealedOptions: @escaping (ItemCollectionId?, ItemCollectionId?) -> Void, addPack: @escaping (StickerPackCollectionInfo) -> Void, removePack: @escaping (StickerPackCollectionInfo) -> Void) {
|
||||||
self.account = account
|
self.context = context
|
||||||
self.openStickerPack = openStickerPack
|
self.openStickerPack = openStickerPack
|
||||||
self.setPackIdWithRevealedOptions = setPackIdWithRevealedOptions
|
self.setPackIdWithRevealedOptions = setPackIdWithRevealedOptions
|
||||||
self.addPack = addPack
|
self.addPack = addPack
|
||||||
@ -135,7 +135,7 @@ private enum ArchivedStickerPacksEntry: ItemListNodeEntry {
|
|||||||
case let .info(_, text):
|
case let .info(_, text):
|
||||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||||
case let .pack(_, _, _, info, topItem, count, animatedStickers, enabled, editing):
|
case let .pack(_, _, _, info, topItem, count, animatedStickers, enabled, editing):
|
||||||
return ItemListStickerPackItem(presentationData: presentationData, account: arguments.account, packInfo: info, itemCount: count, topItem: topItem, unread: false, control: .installation(installed: false), editing: editing, enabled: enabled, playAnimatedStickers: animatedStickers, sectionId: self.section, action: {
|
return ItemListStickerPackItem(presentationData: presentationData, context: arguments.context, packInfo: info, itemCount: count, topItem: topItem, unread: false, control: .installation(installed: false), editing: editing, enabled: enabled, playAnimatedStickers: animatedStickers, sectionId: self.section, action: {
|
||||||
arguments.openStickerPack(info)
|
arguments.openStickerPack(info)
|
||||||
}, setPackIdWithRevealedOptions: { current, previous in
|
}, setPackIdWithRevealedOptions: { current, previous in
|
||||||
arguments.setPackIdWithRevealedOptions(current, previous)
|
arguments.setPackIdWithRevealedOptions(current, previous)
|
||||||
@ -264,7 +264,7 @@ public func archivedStickerPacksController(context: AccountContext, mode: Archiv
|
|||||||
|
|
||||||
var presentStickerPackController: ((StickerPackCollectionInfo) -> Void)?
|
var presentStickerPackController: ((StickerPackCollectionInfo) -> Void)?
|
||||||
|
|
||||||
let arguments = ArchivedStickerPacksControllerArguments(account: context.account, openStickerPack: { info in
|
let arguments = ArchivedStickerPacksControllerArguments(context: context, openStickerPack: { info in
|
||||||
presentStickerPackController?(info)
|
presentStickerPackController?(info)
|
||||||
}, setPackIdWithRevealedOptions: { packId, fromPackId in
|
}, setPackIdWithRevealedOptions: { packId, fromPackId in
|
||||||
updateState { state in
|
updateState { state in
|
||||||
|
@ -13,13 +13,13 @@ import StickerPackPreviewUI
|
|||||||
import ItemListStickerPackItem
|
import ItemListStickerPackItem
|
||||||
|
|
||||||
private final class FeaturedStickerPacksControllerArguments {
|
private final class FeaturedStickerPacksControllerArguments {
|
||||||
let account: Account
|
let context: AccountContext
|
||||||
|
|
||||||
let openStickerPack: (StickerPackCollectionInfo) -> Void
|
let openStickerPack: (StickerPackCollectionInfo) -> Void
|
||||||
let addPack: (StickerPackCollectionInfo) -> Void
|
let addPack: (StickerPackCollectionInfo) -> Void
|
||||||
|
|
||||||
init(account: Account, openStickerPack: @escaping (StickerPackCollectionInfo) -> Void, addPack: @escaping (StickerPackCollectionInfo) -> Void) {
|
init(context: AccountContext, openStickerPack: @escaping (StickerPackCollectionInfo) -> Void, addPack: @escaping (StickerPackCollectionInfo) -> Void) {
|
||||||
self.account = account
|
self.context = context
|
||||||
self.openStickerPack = openStickerPack
|
self.openStickerPack = openStickerPack
|
||||||
self.addPack = addPack
|
self.addPack = addPack
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ private enum FeaturedStickerPacksEntry: ItemListNodeEntry {
|
|||||||
let arguments = arguments as! FeaturedStickerPacksControllerArguments
|
let arguments = arguments as! FeaturedStickerPacksControllerArguments
|
||||||
switch self {
|
switch self {
|
||||||
case let .pack(_, _, _, info, unread, topItem, count, playAnimatedStickers, installed):
|
case let .pack(_, _, _, info, unread, topItem, count, playAnimatedStickers, installed):
|
||||||
return ItemListStickerPackItem(presentationData: presentationData, account: arguments.account, packInfo: info, itemCount: count, topItem: topItem, unread: unread, control: .installation(installed: installed), editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false, selectable: false), enabled: true, playAnimatedStickers: playAnimatedStickers, sectionId: self.section, action: {
|
return ItemListStickerPackItem(presentationData: presentationData, context: arguments.context, packInfo: info, itemCount: count, topItem: topItem, unread: unread, control: .installation(installed: installed), editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false, selectable: false), enabled: true, playAnimatedStickers: playAnimatedStickers, sectionId: self.section, action: {
|
||||||
arguments.openStickerPack(info)
|
arguments.openStickerPack(info)
|
||||||
}, setPackIdWithRevealedOptions: { _, _ in
|
}, setPackIdWithRevealedOptions: { _, _ in
|
||||||
}, addPack: {
|
}, addPack: {
|
||||||
@ -168,7 +168,7 @@ public func featuredStickerPacksController(context: AccountContext) -> ViewContr
|
|||||||
|
|
||||||
var presentStickerPackController: ((StickerPackCollectionInfo) -> Void)?
|
var presentStickerPackController: ((StickerPackCollectionInfo) -> Void)?
|
||||||
|
|
||||||
let arguments = FeaturedStickerPacksControllerArguments(account: context.account, openStickerPack: { info in
|
let arguments = FeaturedStickerPacksControllerArguments(context: context, openStickerPack: { info in
|
||||||
presentStickerPackController?(info)
|
presentStickerPackController?(info)
|
||||||
}, addPack: { info in
|
}, addPack: { info in
|
||||||
let _ = (context.engine.stickers.loadedStickerPack(reference: .id(id: info.id.id, accessHash: info.accessHash), forceActualized: false)
|
let _ = (context.engine.stickers.loadedStickerPack(reference: .id(id: info.id.id, accessHash: info.accessHash), forceActualized: false)
|
||||||
|
@ -451,7 +451,7 @@ private indirect enum InstalledStickerPacksEntry: ItemListNodeEntry {
|
|||||||
case let .trendingPacksTitle(_, text):
|
case let .trendingPacksTitle(_, text):
|
||||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||||
case let .trendingPack(_, _, _, info, topItem, count, animatedStickers, unread, installed):
|
case let .trendingPack(_, _, _, info, topItem, count, animatedStickers, unread, installed):
|
||||||
return ItemListStickerPackItem(presentationData: presentationData, account: arguments.context.account, packInfo: info, itemCount: count, topItem: topItem, unread: unread, control: .installation(installed: installed), editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false, selectable: false), enabled: true, playAnimatedStickers: animatedStickers, sectionId: self.section, action: {
|
return ItemListStickerPackItem(presentationData: presentationData, context: arguments.context, packInfo: info, itemCount: count, topItem: topItem, unread: unread, control: .installation(installed: installed), editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false, selectable: false), enabled: true, playAnimatedStickers: animatedStickers, sectionId: self.section, action: {
|
||||||
arguments.openStickerPack(info)
|
arguments.openStickerPack(info)
|
||||||
}, setPackIdWithRevealedOptions: { _, _ in
|
}, setPackIdWithRevealedOptions: { _, _ in
|
||||||
}, addPack: {
|
}, addPack: {
|
||||||
@ -466,7 +466,7 @@ private indirect enum InstalledStickerPacksEntry: ItemListNodeEntry {
|
|||||||
case let .packsTitle(_, text):
|
case let .packsTitle(_, text):
|
||||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||||
case let .pack(_, _, _, info, topItem, count, animatedStickers, enabled, editing, selected):
|
case let .pack(_, _, _, info, topItem, count, animatedStickers, enabled, editing, selected):
|
||||||
return ItemListStickerPackItem(presentationData: presentationData, account: arguments.context.account, packInfo: info, itemCount: count, topItem: topItem, unread: false, control: editing.editing ? .check(checked: selected ?? false) : .none, editing: editing, enabled: enabled, playAnimatedStickers: animatedStickers, sectionId: self.section, action: {
|
return ItemListStickerPackItem(presentationData: presentationData, context: arguments.context, packInfo: info, itemCount: count, topItem: topItem, unread: false, control: editing.editing ? .check(checked: selected ?? false) : .none, editing: editing, enabled: enabled, playAnimatedStickers: animatedStickers, sectionId: self.section, action: {
|
||||||
arguments.openStickerPack(info)
|
arguments.openStickerPack(info)
|
||||||
}, setPackIdWithRevealedOptions: { current, previous in
|
}, setPackIdWithRevealedOptions: { current, previous in
|
||||||
arguments.setPackIdWithRevealedOptions(current, previous)
|
arguments.setPackIdWithRevealedOptions(current, previous)
|
||||||
|
@ -440,7 +440,7 @@ private final class ThemeCarouselThemeItemIconNode : ListViewItemNode {
|
|||||||
strongSelf.stickerFetchedDisposable.set(fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)).start())
|
strongSelf.stickerFetchedDisposable.set(fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)).start())
|
||||||
|
|
||||||
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
||||||
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: file.immediateThumbnailData, size: emojiFrame.size, imageSize: thumbnailDimensions.cgSize)
|
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: file.immediateThumbnailData, size: emojiFrame.size, enableEffect: item.context.sharedContext.energyUsageSettings.fullTranslucency, imageSize: thumbnailDimensions.cgSize)
|
||||||
strongSelf.placeholderNode.frame = emojiFrame
|
strongSelf.placeholderNode.frame = emojiFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ private final class ThemeGridThemeItemIconNode : ASDisplayNode {
|
|||||||
self.stickerFetchedDisposable.set(fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .other, reference: MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)).start())
|
self.stickerFetchedDisposable.set(fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .other, reference: MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)).start())
|
||||||
|
|
||||||
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
||||||
self.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: file.immediateThumbnailData, size: emojiFrame.size, imageSize: thumbnailDimensions.cgSize)
|
self.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: file.immediateThumbnailData, size: emojiFrame.size, enableEffect: item.context.sharedContext.energyUsageSettings.fullTranslucency, imageSize: thumbnailDimensions.cgSize)
|
||||||
self.placeholderNode.frame = emojiFrame
|
self.placeholderNode.frame = emojiFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,8 @@ public class StickerShimmerEffectNode: ASDisplayNode {
|
|||||||
self.backdropNode = backdropNode
|
self.backdropNode = backdropNode
|
||||||
self.insertSubnode(backdropNode, at: 0)
|
self.insertSubnode(backdropNode, at: 0)
|
||||||
|
|
||||||
|
backdropNode.isHidden = self.effectNode.isHidden
|
||||||
|
|
||||||
self.effectNode.layer.compositingFilter = "screenBlendMode"
|
self.effectNode.layer.compositingFilter = "screenBlendMode"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +99,7 @@ public class StickerShimmerEffectNode: ASDisplayNode {
|
|||||||
self.effectNode.updateAbsoluteRect(rect, within: containerSize)
|
self.effectNode.updateAbsoluteRect(rect, within: containerSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func update(backgroundColor: UIColor?, foregroundColor: UIColor, shimmeringColor: UIColor, data: Data?, size: CGSize, imageSize: CGSize = CGSize(width: 512.0, height: 512.0)) {
|
public func update(backgroundColor: UIColor?, foregroundColor: UIColor, shimmeringColor: UIColor, data: Data?, size: CGSize, enableEffect: Bool, imageSize: CGSize = CGSize(width: 512.0, height: 512.0)) {
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -112,13 +114,18 @@ public class StickerShimmerEffectNode: ASDisplayNode {
|
|||||||
self.currentSize = size
|
self.currentSize = size
|
||||||
|
|
||||||
self.backgroundNode.backgroundColor = foregroundColor
|
self.backgroundNode.backgroundColor = foregroundColor
|
||||||
|
self.backgroundNode.isHidden = !enableEffect
|
||||||
|
|
||||||
self.effectNode.update(backgroundColor: backgroundColor == nil ? .clear : foregroundColor, foregroundColor: shimmeringColor, horizontal: true, effectSize: nil, globalTimeOffset: true, duration: nil)
|
if enableEffect {
|
||||||
|
self.effectNode.update(backgroundColor: backgroundColor == nil ? .clear : foregroundColor, foregroundColor: shimmeringColor, horizontal: true, effectSize: nil, globalTimeOffset: true, duration: nil)
|
||||||
|
}
|
||||||
|
self.effectNode.isHidden = !enableEffect
|
||||||
|
self.backdropNode?.isHidden = !enableEffect
|
||||||
|
|
||||||
let bounds = CGRect(origin: CGPoint(), size: size)
|
let bounds = CGRect(origin: CGPoint(), size: size)
|
||||||
let image = generateStickerPlaceholderImage(data: data, size: size, imageSize: imageSize, backgroundColor: backgroundColor, foregroundColor: .black)
|
let image = generateStickerPlaceholderImage(data: data, size: size, imageSize: imageSize, backgroundColor: backgroundColor, foregroundColor: enableEffect ? .black : foregroundColor)
|
||||||
|
|
||||||
if backgroundColor == nil {
|
if backgroundColor == nil && enableEffect {
|
||||||
self.foregroundNode.image = nil
|
self.foregroundNode.image = nil
|
||||||
|
|
||||||
let maskView: UIImageView
|
let maskView: UIImageView
|
||||||
|
@ -13,6 +13,7 @@ import TextFormat
|
|||||||
import AccountContext
|
import AccountContext
|
||||||
import ContextUI
|
import ContextUI
|
||||||
import StickerPeekUI
|
import StickerPeekUI
|
||||||
|
import AccountContext
|
||||||
|
|
||||||
private struct StickerPackPreviewGridEntry: Comparable, Identifiable {
|
private struct StickerPackPreviewGridEntry: Comparable, Identifiable {
|
||||||
let index: Int
|
let index: Int
|
||||||
@ -26,8 +27,8 @@ private struct StickerPackPreviewGridEntry: Comparable, Identifiable {
|
|||||||
return lhs.index < rhs.index
|
return lhs.index < rhs.index
|
||||||
}
|
}
|
||||||
|
|
||||||
func item(account: Account, interaction: StickerPackPreviewInteraction, theme: PresentationTheme) -> StickerPackPreviewGridItem {
|
func item(context: AccountContext, interaction: StickerPackPreviewInteraction, theme: PresentationTheme) -> StickerPackPreviewGridItem {
|
||||||
return StickerPackPreviewGridItem(account: account, stickerItem: self.stickerItem, interaction: interaction, theme: theme, isPremium: false, isLocked: false, isEmpty: false)
|
return StickerPackPreviewGridItem(context: context, stickerItem: self.stickerItem, interaction: interaction, theme: theme, isPremium: false, isLocked: false, isEmpty: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,12 +37,12 @@ private struct StickerPackPreviewGridTransaction {
|
|||||||
let insertions: [GridNodeInsertItem]
|
let insertions: [GridNodeInsertItem]
|
||||||
let updates: [GridNodeUpdateItem]
|
let updates: [GridNodeUpdateItem]
|
||||||
|
|
||||||
init(previousList: [StickerPackPreviewGridEntry], list: [StickerPackPreviewGridEntry], account: Account, interaction: StickerPackPreviewInteraction, theme: PresentationTheme) {
|
init(previousList: [StickerPackPreviewGridEntry], list: [StickerPackPreviewGridEntry], context: AccountContext, interaction: StickerPackPreviewInteraction, theme: PresentationTheme) {
|
||||||
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: previousList, rightList: list)
|
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: previousList, rightList: list)
|
||||||
|
|
||||||
self.deletions = deleteIndices
|
self.deletions = deleteIndices
|
||||||
self.insertions = indicesAndItems.map { GridNodeInsertItem(index: $0.0, item: $0.1.item(account: account, interaction: interaction, theme: theme), previousIndex: $0.2) }
|
self.insertions = indicesAndItems.map { GridNodeInsertItem(index: $0.0, item: $0.1.item(context: context, interaction: interaction, theme: theme), previousIndex: $0.2) }
|
||||||
self.updates = updateIndices.map { GridNodeUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(account: account, interaction: interaction, theme: theme)) }
|
self.updates = updateIndices.map { GridNodeUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(context: context, interaction: interaction, theme: theme)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +404,7 @@ final class StickerPackPreviewControllerNode: ViewControllerTracingNode, UIScrol
|
|||||||
self.contentTitleNode.attributedText = stringWithAppliedEntities(info.title, entities: entities, baseColor: self.presentationData.theme.actionSheet.primaryTextColor, linkColor: self.presentationData.theme.actionSheet.controlAccentColor, baseFont: font, linkFont: font, boldFont: font, italicFont: font, boldItalicFont: font, fixedFont: font, blockQuoteFont: font, message: nil)
|
self.contentTitleNode.attributedText = stringWithAppliedEntities(info.title, entities: entities, baseColor: self.presentationData.theme.actionSheet.primaryTextColor, linkColor: self.presentationData.theme.actionSheet.controlAccentColor, baseFont: font, linkFont: font, boldFont: font, italicFont: font, boldItalicFont: font, fixedFont: font, blockQuoteFont: font, message: nil)
|
||||||
animateIn = true
|
animateIn = true
|
||||||
}
|
}
|
||||||
transaction = StickerPackPreviewGridTransaction(previousList: self.currentItems, list: updatedItems, account: self.context.account, interaction: self.interaction, theme: self.presentationData.theme)
|
transaction = StickerPackPreviewGridTransaction(previousList: self.currentItems, list: updatedItems, context: self.context, interaction: self.interaction, theme: self.presentationData.theme)
|
||||||
self.currentItems = updatedItems
|
self.currentItems = updatedItems
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ final class StickerPackPreviewInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final class StickerPackPreviewGridItem: GridItem {
|
final class StickerPackPreviewGridItem: GridItem {
|
||||||
let account: Account
|
let context: AccountContext
|
||||||
let stickerItem: StickerPackItem?
|
let stickerItem: StickerPackItem?
|
||||||
let interaction: StickerPackPreviewInteraction
|
let interaction: StickerPackPreviewInteraction
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
@ -43,8 +43,8 @@ final class StickerPackPreviewGridItem: GridItem {
|
|||||||
|
|
||||||
let section: GridSection? = nil
|
let section: GridSection? = nil
|
||||||
|
|
||||||
init(account: Account, stickerItem: StickerPackItem?, interaction: StickerPackPreviewInteraction, theme: PresentationTheme, isPremium: Bool, isLocked: Bool, isEmpty: Bool) {
|
init(context: AccountContext, stickerItem: StickerPackItem?, interaction: StickerPackPreviewInteraction, theme: PresentationTheme, isPremium: Bool, isLocked: Bool, isEmpty: Bool) {
|
||||||
self.account = account
|
self.context = context
|
||||||
self.stickerItem = stickerItem
|
self.stickerItem = stickerItem
|
||||||
self.interaction = interaction
|
self.interaction = interaction
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
@ -55,7 +55,7 @@ final class StickerPackPreviewGridItem: GridItem {
|
|||||||
|
|
||||||
func node(layout: GridNodeLayout, synchronousLoad: Bool) -> GridItemNode {
|
func node(layout: GridNodeLayout, synchronousLoad: Bool) -> GridItemNode {
|
||||||
let node = StickerPackPreviewGridItemNode()
|
let node = StickerPackPreviewGridItemNode()
|
||||||
node.setup(account: self.account, stickerItem: self.stickerItem, interaction: self.interaction, theme: self.theme, isLocked: self.isLocked, isPremium: self.isPremium, isEmpty: self.isEmpty)
|
node.setup(context: self.context, stickerItem: self.stickerItem, interaction: self.interaction, theme: self.theme, isLocked: self.isLocked, isPremium: self.isPremium, isEmpty: self.isEmpty)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,14 +64,14 @@ final class StickerPackPreviewGridItem: GridItem {
|
|||||||
assertionFailure()
|
assertionFailure()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
node.setup(account: self.account, stickerItem: self.stickerItem, interaction: self.interaction, theme: self.theme, isLocked: self.isLocked, isPremium: self.isPremium, isEmpty: self.isEmpty)
|
node.setup(context: self.context, stickerItem: self.stickerItem, interaction: self.interaction, theme: self.theme, isLocked: self.isLocked, isPremium: self.isPremium, isEmpty: self.isEmpty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private let textFont = Font.regular(20.0)
|
private let textFont = Font.regular(20.0)
|
||||||
|
|
||||||
final class StickerPackPreviewGridItemNode: GridItemNode {
|
final class StickerPackPreviewGridItemNode: GridItemNode {
|
||||||
private var currentState: (Account, StickerPackItem?)?
|
private var currentState: (AccountContext, StickerPackItem?)?
|
||||||
private var isLocked: Bool?
|
private var isLocked: Bool?
|
||||||
private var isPremium: Bool?
|
private var isPremium: Bool?
|
||||||
private var isEmpty: Bool?
|
private var isEmpty: Bool?
|
||||||
@ -173,11 +173,11 @@ final class StickerPackPreviewGridItemNode: GridItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var setupTimestamp: Double?
|
private var setupTimestamp: Double?
|
||||||
func setup(account: Account, stickerItem: StickerPackItem?, interaction: StickerPackPreviewInteraction, theme: PresentationTheme, isLocked: Bool, isPremium: Bool, isEmpty: Bool) {
|
func setup(context: AccountContext, stickerItem: StickerPackItem?, interaction: StickerPackPreviewInteraction, theme: PresentationTheme, isLocked: Bool, isPremium: Bool, isEmpty: Bool) {
|
||||||
self.interaction = interaction
|
self.interaction = interaction
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
|
||||||
if self.currentState == nil || self.currentState!.0 !== account || self.currentState!.1 != stickerItem || self.isLocked != isLocked || self.isPremium != isPremium || self.isEmpty != isEmpty {
|
if self.currentState == nil || self.currentState!.0 !== context || self.currentState!.1 != stickerItem || self.isLocked != isLocked || self.isPremium != isPremium || self.isEmpty != isEmpty {
|
||||||
self.isLocked = isLocked
|
self.isLocked = isLocked
|
||||||
|
|
||||||
if isLocked {
|
if isLocked {
|
||||||
@ -229,9 +229,9 @@ final class StickerPackPreviewGridItemNode: GridItemNode {
|
|||||||
if stickerItem.file.isAnimatedSticker || stickerItem.file.isVideoSticker {
|
if stickerItem.file.isAnimatedSticker || stickerItem.file.isVideoSticker {
|
||||||
let dimensions = stickerItem.file.dimensions ?? PixelDimensions(width: 512, height: 512)
|
let dimensions = stickerItem.file.dimensions ?? PixelDimensions(width: 512, height: 512)
|
||||||
if stickerItem.file.isVideoSticker {
|
if stickerItem.file.isVideoSticker {
|
||||||
self.imageNode.setSignal(chatMessageSticker(account: account, userLocation: .other, file: stickerItem.file, small: true))
|
self.imageNode.setSignal(chatMessageSticker(account: context.account, userLocation: .other, file: stickerItem.file, small: true))
|
||||||
} else {
|
} else {
|
||||||
self.imageNode.setSignal(chatMessageAnimatedSticker(postbox: account.postbox, userLocation: .other, file: stickerItem.file, small: false, size: dimensions.cgSize.aspectFitted(CGSize(width: 160.0, height: 160.0))))
|
self.imageNode.setSignal(chatMessageAnimatedSticker(postbox: context.account.postbox, userLocation: .other, file: stickerItem.file, small: false, size: dimensions.cgSize.aspectFitted(CGSize(width: 160.0, height: 160.0))))
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.animationNode == nil {
|
if self.animationNode == nil {
|
||||||
@ -255,14 +255,14 @@ final class StickerPackPreviewGridItemNode: GridItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 160.0, height: 160.0))
|
let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 160.0, height: 160.0))
|
||||||
self.animationNode?.setup(source: AnimatedStickerResourceSource(account: account, resource: stickerItem.file.resource, isVideo: stickerItem.file.isVideoSticker), width: Int(fittedDimensions.width), height: Int(fittedDimensions.height), playbackMode: .loop, mode: .cached)
|
self.animationNode?.setup(source: AnimatedStickerResourceSource(account: context.account, resource: stickerItem.file.resource, isVideo: stickerItem.file.isVideoSticker), width: Int(fittedDimensions.width), height: Int(fittedDimensions.height), playbackMode: .loop, mode: .cached)
|
||||||
|
|
||||||
self.animationNode?.visibility = visibility
|
self.animationNode?.visibility = visibility
|
||||||
|
|
||||||
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, userLocation: .other, fileReference: stickerPackFileReference(stickerItem.file), resource: stickerItem.file.resource).start())
|
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: context.account, userLocation: .other, fileReference: stickerPackFileReference(stickerItem.file), resource: stickerItem.file.resource).start())
|
||||||
|
|
||||||
if stickerItem.file.isPremiumSticker, let effect = stickerItem.file.videoThumbnails.first {
|
if stickerItem.file.isPremiumSticker, let effect = stickerItem.file.videoThumbnails.first {
|
||||||
self.effectFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, userLocation: .other, fileReference: stickerPackFileReference(stickerItem.file), resource: effect.resource).start())
|
self.effectFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: context.account, userLocation: .other, fileReference: stickerPackFileReference(stickerItem.file), resource: effect.resource).start())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let animationNode = self.animationNode {
|
if let animationNode = self.animationNode {
|
||||||
@ -270,8 +270,8 @@ final class StickerPackPreviewGridItemNode: GridItemNode {
|
|||||||
self.animationNode = nil
|
self.animationNode = nil
|
||||||
animationNode.removeFromSupernode()
|
animationNode.removeFromSupernode()
|
||||||
}
|
}
|
||||||
self.imageNode.setSignal(chatMessageSticker(account: account, userLocation: .other, file: stickerItem.file, small: true))
|
self.imageNode.setSignal(chatMessageSticker(account: context.account, userLocation: .other, file: stickerItem.file, small: true))
|
||||||
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, userLocation: .other, fileReference: stickerPackFileReference(stickerItem.file), resource: chatMessageStickerResource(file: stickerItem.file, small: true)).start())
|
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: context.account, userLocation: .other, fileReference: stickerPackFileReference(stickerItem.file), resource: chatMessageStickerResource(file: stickerItem.file, small: true)).start())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if isEmpty {
|
if isEmpty {
|
||||||
@ -287,7 +287,7 @@ final class StickerPackPreviewGridItemNode: GridItemNode {
|
|||||||
self.animationNode?.alpha = isLocked ? 0.5 : 1.0
|
self.animationNode?.alpha = isLocked ? 0.5 : 1.0
|
||||||
self.imageNode.alpha = isLocked ? 0.5 : 1.0
|
self.imageNode.alpha = isLocked ? 0.5 : 1.0
|
||||||
|
|
||||||
self.currentState = (account, stickerItem)
|
self.currentState = (context, stickerItem)
|
||||||
self.setNeedsLayout()
|
self.setNeedsLayout()
|
||||||
}
|
}
|
||||||
self.isEmpty = isEmpty
|
self.isEmpty = isEmpty
|
||||||
@ -322,8 +322,8 @@ final class StickerPackPreviewGridItemNode: GridItemNode {
|
|||||||
let placeholderFrame = imageFrame
|
let placeholderFrame = imageFrame
|
||||||
self.placeholderNode.frame = imageFrame
|
self.placeholderNode.frame = imageFrame
|
||||||
|
|
||||||
if let theme = self.theme, let (_, stickerItem) = self.currentState, let item = stickerItem {
|
if let theme = self.theme, let (context, stickerItem) = self.currentState, let item = stickerItem {
|
||||||
self.placeholderNode.update(backgroundColor: theme.list.itemBlocksBackgroundColor, foregroundColor: theme.list.mediaPlaceholderColor, shimmeringColor: theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.4), data: item.file.immediateThumbnailData, size: placeholderFrame.size)
|
self.placeholderNode.update(backgroundColor: theme.list.itemBlocksBackgroundColor, foregroundColor: theme.list.mediaPlaceholderColor, shimmeringColor: theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.4), data: item.file.immediateThumbnailData, size: placeholderFrame.size, enableEffect: context.sharedContext.energyUsageSettings.fullTranslucency)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let lockBackground = self.lockBackground, let lockTintView = self.lockTintView, let lockIconNode = self.lockIconNode {
|
if let lockBackground = self.lockBackground, let lockTintView = self.lockTintView, let lockIconNode = self.lockIconNode {
|
||||||
|
@ -52,7 +52,7 @@ private enum StickerPackPreviewGridEntry: Comparable, Identifiable {
|
|||||||
func item(context: AccountContext, interaction: StickerPackPreviewInteraction, theme: PresentationTheme, strings: PresentationStrings, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer) -> GridItem {
|
func item(context: AccountContext, interaction: StickerPackPreviewInteraction, theme: PresentationTheme, strings: PresentationStrings, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer) -> GridItem {
|
||||||
switch self {
|
switch self {
|
||||||
case let .sticker(_, _, stickerItem, isEmpty, isPremium, isLocked):
|
case let .sticker(_, _, stickerItem, isEmpty, isPremium, isLocked):
|
||||||
return StickerPackPreviewGridItem(account: context.account, stickerItem: stickerItem, interaction: interaction, theme: theme, isPremium: isPremium, isLocked: isLocked, isEmpty: isEmpty)
|
return StickerPackPreviewGridItem(context: context, stickerItem: stickerItem, interaction: interaction, theme: theme, isPremium: isPremium, isLocked: isLocked, isEmpty: isEmpty)
|
||||||
case let .emojis(_, _, info, items, title, isInstalled):
|
case let .emojis(_, _, info, items, title, isInstalled):
|
||||||
return StickerPackEmojisItem(context: context, animationCache: animationCache, animationRenderer: animationRenderer, interaction: interaction, info: info, items: items, theme: theme, strings: strings, title: title, isInstalled: isInstalled, isEmpty: false)
|
return StickerPackEmojisItem(context: context, animationCache: animationCache, animationRenderer: animationRenderer, interaction: interaction, info: info, items: items, theme: theme, strings: strings, title: title, isInstalled: isInstalled, isEmpty: false)
|
||||||
}
|
}
|
||||||
|
@ -192,6 +192,7 @@ public final class ChatControllerInteraction {
|
|||||||
public var updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?
|
public var updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?
|
||||||
public let presentationContext: ChatPresentationContext
|
public let presentationContext: ChatPresentationContext
|
||||||
public var playNextOutgoingGift: Bool = false
|
public var playNextOutgoingGift: Bool = false
|
||||||
|
public var enableFullTranslucency: Bool = true
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
openMessage: @escaping (Message, ChatControllerInteractionOpenMessageMode) -> Bool,
|
openMessage: @escaping (Message, ChatControllerInteractionOpenMessageMode) -> Bool,
|
||||||
|
@ -3650,7 +3650,7 @@ public final class EmojiPagerContentComponent: Component {
|
|||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
self.backgroundView = BlurredBackgroundView(color: nil)
|
self.backgroundView = BlurredBackgroundView(color: nil)
|
||||||
|
|
||||||
if ProcessInfo.processInfo.processorCount > 2 {
|
if ProcessInfo.processInfo.processorCount > 4 {
|
||||||
self.shimmerHostView = PortalSourceView()
|
self.shimmerHostView = PortalSourceView()
|
||||||
self.standaloneShimmerEffect = StandaloneShimmerEffect()
|
self.standaloneShimmerEffect = StandaloneShimmerEffect()
|
||||||
} else {
|
} else {
|
||||||
|
@ -598,7 +598,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.automaticMediaDownloadSettings = context.sharedContext.currentAutomaticMediaDownloadSettings.with { $0 }
|
self.automaticMediaDownloadSettings = context.sharedContext.currentAutomaticMediaDownloadSettings
|
||||||
|
|
||||||
self.stickerSettings = ChatInterfaceStickerSettings(loopAnimatedStickers: false)
|
self.stickerSettings = ChatInterfaceStickerSettings(loopAnimatedStickers: false)
|
||||||
|
|
||||||
@ -4281,6 +4281,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}, scrollToMessageId: { [weak self] index in
|
}, scrollToMessageId: { [weak self] index in
|
||||||
self?.chatDisplayNode.historyNode.scrollToMessage(index: index)
|
self?.chatDisplayNode.historyNode.scrollToMessage(index: index)
|
||||||
}, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings, pollActionState: ChatInterfacePollActionState(), stickerSettings: self.stickerSettings, presentationContext: ChatPresentationContext(context: context, backgroundNode: self.chatBackgroundNode))
|
}, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings, pollActionState: ChatInterfacePollActionState(), stickerSettings: self.stickerSettings, presentationContext: ChatPresentationContext(context: context, backgroundNode: self.chatBackgroundNode))
|
||||||
|
controllerInteraction.enableFullTranslucency = context.sharedContext.energyUsageSettings.fullTranslucency
|
||||||
|
|
||||||
self.controllerInteraction = controllerInteraction
|
self.controllerInteraction = controllerInteraction
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
onTransitionEventImpl?(transition)
|
onTransitionEventImpl?(transition)
|
||||||
})
|
})
|
||||||
|
|
||||||
self.loadingNode = ChatLoadingNode(theme: self.chatPresentationInterfaceState.theme, chatWallpaper: self.chatPresentationInterfaceState.chatWallpaper, bubbleCorners: self.chatPresentationInterfaceState.bubbleCorners)
|
self.loadingNode = ChatLoadingNode(context: context, theme: self.chatPresentationInterfaceState.theme, chatWallpaper: self.chatPresentationInterfaceState.chatWallpaper, bubbleCorners: self.chatPresentationInterfaceState.bubbleCorners)
|
||||||
|
|
||||||
self.inputPanelContainerNode = ChatInputPanelContainer()
|
self.inputPanelContainerNode = ChatInputPanelContainer()
|
||||||
self.inputPanelOverlayNode = SparseNode()
|
self.inputPanelOverlayNode = SparseNode()
|
||||||
|
@ -960,7 +960,7 @@ final class ChatEmptyNode: ASDisplayNode {
|
|||||||
self.currentTheme = interfaceState.theme
|
self.currentTheme = interfaceState.theme
|
||||||
self.currentStrings = interfaceState.strings
|
self.currentStrings = interfaceState.strings
|
||||||
|
|
||||||
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper), enableBlur: dateFillNeedsBlur(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper), transition: .immediate)
|
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper), enableBlur: self.context.sharedContext.energyUsageSettings.fullTranslucency && dateFillNeedsBlur(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper), transition: .immediate)
|
||||||
}
|
}
|
||||||
|
|
||||||
var isScheduledMessages = false
|
var isScheduledMessages = false
|
||||||
|
@ -15,8 +15,8 @@ final class ChatLoadingNode: ASDisplayNode {
|
|||||||
private let activityIndicator: ActivityIndicator
|
private let activityIndicator: ActivityIndicator
|
||||||
private let offset: CGPoint
|
private let offset: CGPoint
|
||||||
|
|
||||||
init(theme: PresentationTheme, chatWallpaper: TelegramWallpaper, bubbleCorners: PresentationChatBubbleCorners) {
|
init(context: AccountContext, theme: PresentationTheme, chatWallpaper: TelegramWallpaper, bubbleCorners: PresentationChatBubbleCorners) {
|
||||||
self.backgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: theme, wallpaper: chatWallpaper), enableBlur: dateFillNeedsBlur(theme: theme, wallpaper: chatWallpaper))
|
self.backgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: theme, wallpaper: chatWallpaper), enableBlur: context.sharedContext.energyUsageSettings.fullTranslucency && dateFillNeedsBlur(theme: theme, wallpaper: chatWallpaper))
|
||||||
|
|
||||||
let serviceColor = serviceMessageColorComponents(theme: theme, wallpaper: chatWallpaper)
|
let serviceColor = serviceMessageColorComponents(theme: theme, wallpaper: chatWallpaper)
|
||||||
self.activityIndicator = ActivityIndicator(type: .custom(serviceColor.primaryText, 22.0, 2.0, false), speed: .regular)
|
self.activityIndicator = ActivityIndicator(type: .custom(serviceColor.primaryText, 22.0, 2.0, false), speed: .regular)
|
||||||
|
@ -383,7 +383,7 @@ final class ChatMediaInputStickerGridItemNode: GridItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let theme = item.theme
|
let theme = item.theme
|
||||||
placeholderNode.update(backgroundColor: theme.chat.inputMediaPanel.stickersBackgroundColor.withAlphaComponent(1.0), foregroundColor: theme.chat.inputMediaPanel.stickersSectionTextColor.blitOver(theme.chat.inputMediaPanel.stickersBackgroundColor, alpha: 0.15), shimmeringColor: theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.3), data: item.stickerItem.file.immediateThumbnailData, size: placeholderFrame.size)
|
placeholderNode.update(backgroundColor: theme.chat.inputMediaPanel.stickersBackgroundColor.withAlphaComponent(1.0), foregroundColor: theme.chat.inputMediaPanel.stickersSectionTextColor.blitOver(theme.chat.inputMediaPanel.stickersBackgroundColor, alpha: 0.15), shimmeringColor: theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.3), data: item.stickerItem.file.immediateThumbnailData, size: placeholderFrame.size, enableEffect: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let lockBackground = self.lockBackground, let lockTintView = self.lockTintView, let lockIconNode = self.lockIconNode {
|
if let lockBackground = self.lockBackground, let lockTintView = self.lockTintView, let lockIconNode = self.lockIconNode {
|
||||||
|
@ -269,7 +269,7 @@ final class ChatMediaInputStickerPackItemNode: ListViewItemNode {
|
|||||||
immediateThumbnailData = data
|
immediateThumbnailData = data
|
||||||
}
|
}
|
||||||
|
|
||||||
placeholderNode.update(backgroundColor: nil, foregroundColor: theme.chat.inputMediaPanel.stickersSectionTextColor.blitOver(theme.chat.inputPanel.panelBackgroundColor, alpha: 0.4), shimmeringColor: theme.chat.inputMediaPanel.panelHighlightedIconBackgroundColor.withMultipliedAlpha(0.2), data: immediateThumbnailData, size: boundingImageSize, imageSize: imageSize.cgSize)
|
placeholderNode.update(backgroundColor: nil, foregroundColor: theme.chat.inputMediaPanel.stickersSectionTextColor.blitOver(theme.chat.inputPanel.panelBackgroundColor, alpha: 0.4), shimmeringColor: theme.chat.inputMediaPanel.panelHighlightedIconBackgroundColor.withMultipliedAlpha(0.2), data: immediateThumbnailData, size: boundingImageSize, enableEffect: true, imageSize: imageSize.cgSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.containerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: expandedBoundingSize)
|
self.containerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: expandedBoundingSize)
|
||||||
|
@ -181,7 +181,7 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
|||||||
|
|
||||||
animation.animator.updateFrame(layer: node.backgroundBlurNode.layer, frame: CGRect(origin: CGPoint(), size: CGSize(width: max(0.0, width), height: 42.0)), completion: nil)
|
animation.animator.updateFrame(layer: node.backgroundBlurNode.layer, frame: CGRect(origin: CGPoint(), size: CGSize(width: max(0.0, width), height: 42.0)), completion: nil)
|
||||||
node.backgroundBlurNode.update(size: node.backgroundBlurNode.bounds.size, cornerRadius: 0.0, animator: animation.animator)
|
node.backgroundBlurNode.update(size: node.backgroundBlurNode.bounds.size, cornerRadius: 0.0, animator: animation.animator)
|
||||||
node.backgroundBlurNode.updateColor(color: selectDateFillStaticColor(theme: theme.theme, wallpaper: theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: theme.theme, wallpaper: theme.wallpaper), transition: .immediate)
|
node.backgroundBlurNode.updateColor(color: selectDateFillStaticColor(theme: theme.theme, wallpaper: theme.wallpaper), enableBlur: context.sharedContext.energyUsageSettings.fullTranslucency && dateFillNeedsBlur(theme: theme.theme, wallpaper: theme.wallpaper), transition: .immediate)
|
||||||
|
|
||||||
if backgroundNode?.hasExtraBubbleBackground() == true {
|
if backgroundNode?.hasExtraBubbleBackground() == true {
|
||||||
if node.backgroundContent == nil, let backgroundContent = backgroundNode?.makeBubbleBackground(for: .free) {
|
if node.backgroundContent == nil, let backgroundContent = backgroundNode?.makeBubbleBackground(for: .free) {
|
||||||
|
@ -125,7 +125,7 @@ class ChatMessageShareButton: HighlightableButtonNode {
|
|||||||
} else {
|
} else {
|
||||||
updatedIconImage = PresentationResourcesChat.chatFreeShareButtonIcon(presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper)
|
updatedIconImage = PresentationResourcesChat.chatFreeShareButtonIcon(presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper)
|
||||||
}
|
}
|
||||||
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), transition: .immediate)
|
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), enableBlur: controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), transition: .immediate)
|
||||||
self.iconNode.image = updatedIconImage
|
self.iconNode.image = updatedIconImage
|
||||||
self.iconOffset = updatedIconOffset
|
self.iconOffset = updatedIconOffset
|
||||||
}
|
}
|
||||||
@ -1444,7 +1444,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
|
|
||||||
let foregroundColor = bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.stickerPlaceholderColor, wallpaper: item.presentationData.theme.wallpaper)
|
let foregroundColor = bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.stickerPlaceholderColor, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
let shimmeringColor = bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.stickerPlaceholderShimmerColor, wallpaper: item.presentationData.theme.wallpaper)
|
let shimmeringColor = bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.stickerPlaceholderShimmerColor, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: foregroundColor, shimmeringColor: shimmeringColor, data: immediateThumbnailData, size: animationNodeFrame.size, imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0))
|
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: foregroundColor, shimmeringColor: shimmeringColor, data: immediateThumbnailData, size: animationNodeFrame.size, enableEffect: item.context.sharedContext.energyUsageSettings.fullTranslucency, imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0))
|
||||||
strongSelf.placeholderNode.frame = animationNodeFrame
|
strongSelf.placeholderNode.frame = animationNodeFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1488,9 +1488,9 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
|
|
||||||
if needsReplyBackground {
|
if needsReplyBackground {
|
||||||
if let replyBackgroundNode = strongSelf.replyBackgroundNode {
|
if let replyBackgroundNode = strongSelf.replyBackgroundNode {
|
||||||
replyBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
replyBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
||||||
} else {
|
} else {
|
||||||
let replyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
let replyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
||||||
strongSelf.replyBackgroundNode = replyBackgroundNode
|
strongSelf.replyBackgroundNode = replyBackgroundNode
|
||||||
strongSelf.contextSourceNode.contentNode.addSubnode(replyBackgroundNode)
|
strongSelf.contextSourceNode.contentNode.addSubnode(replyBackgroundNode)
|
||||||
}
|
}
|
||||||
@ -2442,7 +2442,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let item = self.item, self.swipeToReplyNode == nil {
|
if let item = self.item, self.swipeToReplyNode == nil {
|
||||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), backgroundNode: item.controllerInteraction.presentationContext.backgroundNode, action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), backgroundNode: item.controllerInteraction.presentationContext.backgroundNode, action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.insertSubnode(swipeToReplyNode, at: 0)
|
self.insertSubnode(swipeToReplyNode, at: 0)
|
||||||
}
|
}
|
||||||
|
@ -4240,7 +4240,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let item = self.item, self.swipeToReplyNode == nil {
|
if let item = self.item, self.swipeToReplyNode == nil {
|
||||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), backgroundNode: item.controllerInteraction.presentationContext.backgroundNode, action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), backgroundNode: item.controllerInteraction.presentationContext.backgroundNode, action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.insertSubnode(swipeToReplyNode, at: 0)
|
self.insertSubnode(swipeToReplyNode, at: 0)
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
|
|||||||
let serviceColor = serviceMessageColorComponents(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper)
|
let serviceColor = serviceMessageColorComponents(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper)
|
||||||
dateColor = serviceColor.primaryText
|
dateColor = serviceColor.primaryText
|
||||||
|
|
||||||
blurredBackgroundColor = (selectDateFillStaticColor(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper), dateFillNeedsBlur(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper))
|
blurredBackgroundColor = (selectDateFillStaticColor(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper), arguments.context.sharedContext.energyUsageSettings.fullTranslucency && dateFillNeedsBlur(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper))
|
||||||
leftInset = 0.0
|
leftInset = 0.0
|
||||||
loadedCheckFullImage = PresentationResourcesChat.chatFreeFullCheck(arguments.presentationData.theme.theme, size: checkSize, isDefaultWallpaper: isDefaultWallpaper)
|
loadedCheckFullImage = PresentationResourcesChat.chatFreeFullCheck(arguments.presentationData.theme.theme, size: checkSize, isDefaultWallpaper: isDefaultWallpaper)
|
||||||
loadedCheckPartialImage = PresentationResourcesChat.chatFreePartialCheck(arguments.presentationData.theme.theme, size: checkSize, isDefaultWallpaper: isDefaultWallpaper)
|
loadedCheckPartialImage = PresentationResourcesChat.chatFreePartialCheck(arguments.presentationData.theme.theme, size: checkSize, isDefaultWallpaper: isDefaultWallpaper)
|
||||||
@ -492,7 +492,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
|
|||||||
let serviceColor = serviceMessageColorComponents(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper)
|
let serviceColor = serviceMessageColorComponents(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper)
|
||||||
dateColor = serviceColor.primaryText
|
dateColor = serviceColor.primaryText
|
||||||
outgoingStatus = status
|
outgoingStatus = status
|
||||||
blurredBackgroundColor = (selectDateFillStaticColor(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper), dateFillNeedsBlur(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper))
|
blurredBackgroundColor = (selectDateFillStaticColor(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper), arguments.context.sharedContext.energyUsageSettings.fullTranslucency && dateFillNeedsBlur(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper))
|
||||||
leftInset = 0.0
|
leftInset = 0.0
|
||||||
loadedCheckFullImage = PresentationResourcesChat.chatFreeFullCheck(arguments.presentationData.theme.theme, size: checkSize, isDefaultWallpaper: isDefaultWallpaper)
|
loadedCheckFullImage = PresentationResourcesChat.chatFreeFullCheck(arguments.presentationData.theme.theme, size: checkSize, isDefaultWallpaper: isDefaultWallpaper)
|
||||||
loadedCheckPartialImage = PresentationResourcesChat.chatFreePartialCheck(arguments.presentationData.theme.theme, size: checkSize, isDefaultWallpaper: isDefaultWallpaper)
|
loadedCheckPartialImage = PresentationResourcesChat.chatFreePartialCheck(arguments.presentationData.theme.theme, size: checkSize, isDefaultWallpaper: isDefaultWallpaper)
|
||||||
|
@ -200,7 +200,9 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, bubbleCorners: presentationData.chatBubbleCorners)
|
let graphics = PresentationResourcesChat.principalGraphics(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, bubbleCorners: presentationData.chatBubbleCorners)
|
||||||
|
|
||||||
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), transition: .immediate)
|
let fullTranslucency: Bool = controllerInteraction?.enableFullTranslucency ?? true
|
||||||
|
|
||||||
|
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), enableBlur: fullTranslucency && dateFillNeedsBlur(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), transition: .immediate)
|
||||||
self.stickBackgroundNode.image = graphics.dateFloatingBackground
|
self.stickBackgroundNode.image = graphics.dateFloatingBackground
|
||||||
self.stickBackgroundNode.alpha = 0.0
|
self.stickBackgroundNode.alpha = 0.0
|
||||||
|
|
||||||
@ -236,8 +238,10 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
self.presentationData = presentationData
|
self.presentationData = presentationData
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, bubbleCorners: presentationData.chatBubbleCorners)
|
let graphics = PresentationResourcesChat.principalGraphics(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, bubbleCorners: presentationData.chatBubbleCorners)
|
||||||
|
|
||||||
|
let fullTranslucency: Bool = self.controllerInteraction?.enableFullTranslucency ?? true
|
||||||
|
|
||||||
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), transition: .immediate)
|
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), enableBlur: fullTranslucency && dateFillNeedsBlur(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), transition: .immediate)
|
||||||
self.stickBackgroundNode.image = graphics.dateFloatingBackground
|
self.stickBackgroundNode.image = graphics.dateFloatingBackground
|
||||||
|
|
||||||
let titleFont = Font.medium(min(18.0, floor(presentationData.fontSize.baseDisplaySize * 13.0 / 17.0)))
|
let titleFont = Font.medium(min(18.0, floor(presentationData.fontSize.baseDisplaySize * 13.0 / 17.0)))
|
||||||
|
@ -236,7 +236,7 @@ class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
let mediaBackgroundFrame = imageFrame.insetBy(dx: -2.0, dy: -2.0)
|
let mediaBackgroundFrame = imageFrame.insetBy(dx: -2.0, dy: -2.0)
|
||||||
strongSelf.mediaBackgroundNode.frame = mediaBackgroundFrame
|
strongSelf.mediaBackgroundNode.frame = mediaBackgroundFrame
|
||||||
|
|
||||||
strongSelf.mediaBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
strongSelf.mediaBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
||||||
strongSelf.mediaBackgroundNode.update(size: mediaBackgroundFrame.size, transition: .immediate)
|
strongSelf.mediaBackgroundNode.update(size: mediaBackgroundFrame.size, transition: .immediate)
|
||||||
strongSelf.buttonNode.backgroundColor = item.presentationData.theme.theme.overallDarkAppearance ? UIColor(rgb: 0xffffff, alpha: 0.12) : UIColor(rgb: 0x000000, alpha: 0.12)
|
strongSelf.buttonNode.backgroundColor = item.presentationData.theme.theme.overallDarkAppearance ? UIColor(rgb: 0xffffff, alpha: 0.12) : UIColor(rgb: 0x000000, alpha: 0.12)
|
||||||
|
|
||||||
|
@ -525,10 +525,10 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
|||||||
if let currentReplyBackgroundNode = currentReplyBackgroundNode {
|
if let currentReplyBackgroundNode = currentReplyBackgroundNode {
|
||||||
updatedReplyBackgroundNode = currentReplyBackgroundNode
|
updatedReplyBackgroundNode = currentReplyBackgroundNode
|
||||||
} else {
|
} else {
|
||||||
updatedReplyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
updatedReplyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
||||||
}
|
}
|
||||||
|
|
||||||
updatedReplyBackgroundNode?.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
updatedReplyBackgroundNode?.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxContentWidth = normalDisplaySize.width
|
var maxContentWidth = normalDisplaySize.width
|
||||||
@ -1009,7 +1009,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
|||||||
translation.x = max(-80.0, min(0.0, translation.x))
|
translation.x = max(-80.0, min(0.0, translation.x))
|
||||||
|
|
||||||
if let item = self.item, self.swipeToReplyNode == nil {
|
if let item = self.item, self.swipeToReplyNode == nil {
|
||||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), backgroundNode: item.controllerInteraction.presentationContext.backgroundNode, action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), backgroundNode: item.controllerInteraction.presentationContext.backgroundNode, action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.insertSubnode(swipeToReplyNode, at: 0)
|
self.insertSubnode(swipeToReplyNode, at: 0)
|
||||||
}
|
}
|
||||||
|
@ -561,10 +561,10 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||||||
if let currentReplyBackgroundNode = currentReplyBackgroundNode {
|
if let currentReplyBackgroundNode = currentReplyBackgroundNode {
|
||||||
updatedReplyBackgroundNode = currentReplyBackgroundNode
|
updatedReplyBackgroundNode = currentReplyBackgroundNode
|
||||||
} else {
|
} else {
|
||||||
updatedReplyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
updatedReplyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
||||||
}
|
}
|
||||||
|
|
||||||
updatedReplyBackgroundNode?.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
updatedReplyBackgroundNode?.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (result, { [weak self] layoutData, animation in
|
return (result, { [weak self] layoutData, animation in
|
||||||
@ -625,7 +625,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||||||
case .free:
|
case .free:
|
||||||
let serviceColor = serviceMessageColorComponents(theme: theme.theme, wallpaper: theme.wallpaper)
|
let serviceColor = serviceMessageColorComponents(theme: theme.theme, wallpaper: theme.wallpaper)
|
||||||
durationTextColor = serviceColor.primaryText
|
durationTextColor = serviceColor.primaryText
|
||||||
durationBlurColor = (selectDateFillStaticColor(theme: theme.theme, wallpaper: theme.wallpaper), dateFillNeedsBlur(theme: theme.theme, wallpaper: theme.wallpaper))
|
durationBlurColor = (selectDateFillStaticColor(theme: theme.theme, wallpaper: theme.wallpaper), item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: theme.theme, wallpaper: theme.wallpaper))
|
||||||
case .bubble:
|
case .bubble:
|
||||||
durationBlurColor = nil
|
durationBlurColor = nil
|
||||||
if incoming {
|
if incoming {
|
||||||
|
@ -254,7 +254,7 @@ class ChatMessageProfilePhotoSuggestionContentNode: ChatMessageBubbleContentNode
|
|||||||
let mediaBackgroundFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((backgroundSize.width - width) / 2.0), y: 0.0), size: backgroundSize)
|
let mediaBackgroundFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((backgroundSize.width - width) / 2.0), y: 0.0), size: backgroundSize)
|
||||||
strongSelf.mediaBackgroundNode.frame = mediaBackgroundFrame
|
strongSelf.mediaBackgroundNode.frame = mediaBackgroundFrame
|
||||||
|
|
||||||
strongSelf.mediaBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
strongSelf.mediaBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
||||||
strongSelf.mediaBackgroundNode.update(size: mediaBackgroundFrame.size, transition: .immediate)
|
strongSelf.mediaBackgroundNode.update(size: mediaBackgroundFrame.size, transition: .immediate)
|
||||||
strongSelf.buttonNode.backgroundColor = item.presentationData.theme.theme.overallDarkAppearance ? UIColor(rgb: 0xffffff, alpha: 0.12) : UIColor(rgb: 0x000000, alpha: 0.12)
|
strongSelf.buttonNode.backgroundColor = item.presentationData.theme.theme.overallDarkAppearance ? UIColor(rgb: 0xffffff, alpha: 0.12) : UIColor(rgb: 0x000000, alpha: 0.12)
|
||||||
|
|
||||||
|
@ -894,7 +894,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
let shimmeringColor = bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.stickerPlaceholderShimmerColor, wallpaper: item.presentationData.theme.wallpaper)
|
let shimmeringColor = bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.stickerPlaceholderShimmerColor, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
|
|
||||||
let placeholderFrame = updatedImageFrame.insetBy(dx: innerImageInset, dy: innerImageInset)
|
let placeholderFrame = updatedImageFrame.insetBy(dx: innerImageInset, dy: innerImageInset)
|
||||||
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: foregroundColor, shimmeringColor: shimmeringColor, data: immediateThumbnailData, size: placeholderFrame.size)
|
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: foregroundColor, shimmeringColor: shimmeringColor, data: immediateThumbnailData, size: placeholderFrame.size, enableEffect: item.context.sharedContext.energyUsageSettings.fullTranslucency)
|
||||||
strongSelf.placeholderNode.frame = placeholderFrame
|
strongSelf.placeholderNode.frame = placeholderFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -927,9 +927,9 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
|
|
||||||
if needsReplyBackground {
|
if needsReplyBackground {
|
||||||
if let replyBackgroundNode = strongSelf.replyBackgroundNode {
|
if let replyBackgroundNode = strongSelf.replyBackgroundNode {
|
||||||
replyBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
replyBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
||||||
} else {
|
} else {
|
||||||
let replyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
let replyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
||||||
strongSelf.replyBackgroundNode = replyBackgroundNode
|
strongSelf.replyBackgroundNode = replyBackgroundNode
|
||||||
strongSelf.contextSourceNode.contentNode.addSubnode(replyBackgroundNode)
|
strongSelf.contextSourceNode.contentNode.addSubnode(replyBackgroundNode)
|
||||||
}
|
}
|
||||||
@ -1412,7 +1412,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let item = self.item, self.swipeToReplyNode == nil {
|
if let item = self.item, self.swipeToReplyNode == nil {
|
||||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), backgroundNode: item.controllerInteraction.presentationContext.backgroundNode, action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), backgroundNode: item.controllerInteraction.presentationContext.backgroundNode, action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.insertSubnode(swipeToReplyNode, at: 0)
|
self.insertSubnode(swipeToReplyNode, at: 0)
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ class ChatMessageThreadInfoNode: ASDisplayNode {
|
|||||||
|
|
||||||
backgroundNode.frame = backgroundFrame
|
backgroundNode.frame = backgroundFrame
|
||||||
backgroundNode.update(size: backgroundNode.bounds.size, cornerRadius: 0.0, transition: .immediate)
|
backgroundNode.update(size: backgroundNode.bounds.size, cornerRadius: 0.0, transition: .immediate)
|
||||||
backgroundNode.updateColor(color: selectDateFillStaticColor(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper), transition: .immediate)
|
backgroundNode.updateColor(color: selectDateFillStaticColor(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper), enableBlur: arguments.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper), transition: .immediate)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
node.contentBackgroundNode.frame = CGRect(origin: CGPoint(x: -1.0, y: -3.0), size: image.size)
|
node.contentBackgroundNode.frame = CGRect(origin: CGPoint(x: -1.0, y: -3.0), size: image.size)
|
||||||
|
@ -516,7 +516,7 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
|
|||||||
strongSelf.stickerFetchedDisposable.set(fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)).start())
|
strongSelf.stickerFetchedDisposable.set(fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)).start())
|
||||||
|
|
||||||
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
||||||
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: file.immediateThumbnailData, size: emojiFrame.size, imageSize: thumbnailDimensions.cgSize)
|
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: file.immediateThumbnailData, size: emojiFrame.size, enableEffect: item.context.sharedContext.energyUsageSettings.fullTranslucency, imageSize: thumbnailDimensions.cgSize)
|
||||||
strongSelf.placeholderNode.frame = emojiFrame
|
strongSelf.placeholderNode.frame = emojiFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
self.presentController = presentController
|
self.presentController = presentController
|
||||||
self.getNavigationController = getNavigationController
|
self.getNavigationController = getNavigationController
|
||||||
|
|
||||||
self.automaticMediaDownloadSettings = context.sharedContext.currentAutomaticMediaDownloadSettings.with { $0 }
|
self.automaticMediaDownloadSettings = context.sharedContext.currentAutomaticMediaDownloadSettings
|
||||||
|
|
||||||
self.backgroundNode = createWallpaperBackgroundNode(context: context, forChatDisplay: true)
|
self.backgroundNode = createWallpaperBackgroundNode(context: context, forChatDisplay: true)
|
||||||
self.backgroundNode.isUserInteractionEnabled = false
|
self.backgroundNode.isUserInteractionEnabled = false
|
||||||
@ -125,7 +125,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
|
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
|
||||||
}
|
}
|
||||||
|
|
||||||
self.loadingNode = ChatLoadingNode(theme: self.presentationData.theme, chatWallpaper: self.presentationData.chatWallpaper, bubbleCorners: self.presentationData.chatBubbleCorners)
|
self.loadingNode = ChatLoadingNode(context: context, theme: self.presentationData.theme, chatWallpaper: self.presentationData.chatWallpaper, bubbleCorners: self.presentationData.chatBubbleCorners)
|
||||||
self.emptyNode = ChatRecentActionsEmptyNode(theme: self.presentationData.theme, chatWallpaper: self.presentationData.chatWallpaper, chatBubbleCorners: self.presentationData.chatBubbleCorners)
|
self.emptyNode = ChatRecentActionsEmptyNode(theme: self.presentationData.theme, chatWallpaper: self.presentationData.chatWallpaper, chatBubbleCorners: self.presentationData.chatBubbleCorners)
|
||||||
self.emptyNode.alpha = 0.0
|
self.emptyNode.alpha = 0.0
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
|
|||||||
strongSelf.stickerFetchedDisposable.set(fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)).start())
|
strongSelf.stickerFetchedDisposable.set(fetchedMediaResource(mediaBox: item.context.account.postbox.mediaBox, userLocation: .other, userContentType: .sticker, reference: MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)).start())
|
||||||
|
|
||||||
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
let thumbnailDimensions = PixelDimensions(width: 512, height: 512)
|
||||||
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: file.immediateThumbnailData, size: emojiFrame.size, imageSize: thumbnailDimensions.cgSize)
|
strongSelf.placeholderNode.update(backgroundColor: nil, foregroundColor: UIColor(rgb: 0xffffff, alpha: 0.2), shimmeringColor: UIColor(rgb: 0xffffff, alpha: 0.3), data: file.immediateThumbnailData, size: emojiFrame.size, enableEffect: item.context.sharedContext.energyUsageSettings.fullTranslucency, imageSize: thumbnailDimensions.cgSize)
|
||||||
strongSelf.placeholderNode.frame = emojiFrame
|
strongSelf.placeholderNode.frame = emojiFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ final class HorizontalListContextResultsChatInputPanelItemNode: ListViewItemNode
|
|||||||
placeholderNode.bounds = CGRect(origin: CGPoint(), size: CGSize(width: croppedImageDimensions.width, height: croppedImageDimensions.height))
|
placeholderNode.bounds = CGRect(origin: CGPoint(), size: CGSize(width: croppedImageDimensions.width, height: croppedImageDimensions.height))
|
||||||
placeholderNode.position = CGPoint(x: height / 2.0, y: (nodeLayout.contentSize.height - sideInset) / 2.0 + sideInset)
|
placeholderNode.position = CGPoint(x: height / 2.0, y: (nodeLayout.contentSize.height - sideInset) / 2.0 + sideInset)
|
||||||
|
|
||||||
placeholderNode.update(backgroundColor: item.theme.list.plainBackgroundColor, foregroundColor: item.theme.list.mediaPlaceholderColor.mixedWith(item.theme.list.plainBackgroundColor, alpha: 0.4), shimmeringColor: item.theme.list.mediaPlaceholderColor.withAlphaComponent(0.3), data: immediateThumbnailData, size: CGSize(width: croppedImageDimensions.width, height: croppedImageDimensions.height))
|
placeholderNode.update(backgroundColor: item.theme.list.plainBackgroundColor, foregroundColor: item.theme.list.mediaPlaceholderColor.mixedWith(item.theme.list.plainBackgroundColor, alpha: 0.4), shimmeringColor: item.theme.list.mediaPlaceholderColor.withAlphaComponent(0.3), data: immediateThumbnailData, size: CGSize(width: croppedImageDimensions.width, height: croppedImageDimensions.height), enableEffect: item.context.sharedContext.energyUsageSettings.fullTranslucency)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -11,9 +11,10 @@ import AnimatedStickerNode
|
|||||||
import TelegramAnimatedStickerNode
|
import TelegramAnimatedStickerNode
|
||||||
import ShimmerEffect
|
import ShimmerEffect
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
|
import AccountContext
|
||||||
|
|
||||||
final class HorizontalStickerGridItem: GridItem {
|
final class HorizontalStickerGridItem: GridItem {
|
||||||
let account: Account
|
let context: AccountContext
|
||||||
let file: TelegramMediaFile
|
let file: TelegramMediaFile
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
let isPreviewed: (HorizontalStickerGridItem) -> Bool
|
let isPreviewed: (HorizontalStickerGridItem) -> Bool
|
||||||
@ -21,8 +22,8 @@ final class HorizontalStickerGridItem: GridItem {
|
|||||||
|
|
||||||
let section: GridSection? = nil
|
let section: GridSection? = nil
|
||||||
|
|
||||||
init(account: Account, file: TelegramMediaFile, theme: PresentationTheme, isPreviewed: @escaping (HorizontalStickerGridItem) -> Bool, sendSticker: @escaping (FileMediaReference, UIView, CGRect) -> Void) {
|
init(context: AccountContext, file: TelegramMediaFile, theme: PresentationTheme, isPreviewed: @escaping (HorizontalStickerGridItem) -> Bool, sendSticker: @escaping (FileMediaReference, UIView, CGRect) -> Void) {
|
||||||
self.account = account
|
self.context = context
|
||||||
self.file = file
|
self.file = file
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.isPreviewed = isPreviewed
|
self.isPreviewed = isPreviewed
|
||||||
@ -31,7 +32,7 @@ final class HorizontalStickerGridItem: GridItem {
|
|||||||
|
|
||||||
func node(layout: GridNodeLayout, synchronousLoad: Bool) -> GridItemNode {
|
func node(layout: GridNodeLayout, synchronousLoad: Bool) -> GridItemNode {
|
||||||
let node = HorizontalStickerGridItemNode()
|
let node = HorizontalStickerGridItemNode()
|
||||||
node.setup(account: self.account, item: self)
|
node.setup(context: self.context, item: self)
|
||||||
node.sendSticker = self.sendSticker
|
node.sendSticker = self.sendSticker
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
@ -41,13 +42,13 @@ final class HorizontalStickerGridItem: GridItem {
|
|||||||
assertionFailure()
|
assertionFailure()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
node.setup(account: self.account, item: self)
|
node.setup(context: self.context, item: self)
|
||||||
node.sendSticker = self.sendSticker
|
node.sendSticker = self.sendSticker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class HorizontalStickerGridItemNode: GridItemNode {
|
final class HorizontalStickerGridItemNode: GridItemNode {
|
||||||
private var currentState: (Account, HorizontalStickerGridItem, CGSize)?
|
private var currentState: (AccountContext, HorizontalStickerGridItem, CGSize)?
|
||||||
let imageNode: TransformImageNode
|
let imageNode: TransformImageNode
|
||||||
private(set) var animationNode: AnimatedStickerNode?
|
private(set) var animationNode: AnimatedStickerNode?
|
||||||
private(set) var placeholderNode: StickerShimmerEffectNode?
|
private(set) var placeholderNode: StickerShimmerEffectNode?
|
||||||
@ -137,8 +138,8 @@ final class HorizontalStickerGridItemNode: GridItemNode {
|
|||||||
self.imageNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.imageNodeTap(_:))))
|
self.imageNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.imageNodeTap(_:))))
|
||||||
}
|
}
|
||||||
|
|
||||||
func setup(account: Account, item: HorizontalStickerGridItem) {
|
func setup(context: AccountContext, item: HorizontalStickerGridItem) {
|
||||||
if self.currentState == nil || self.currentState!.0 !== account || self.currentState!.1.file.id != item.file.id {
|
if self.currentState == nil || self.currentState!.0 !== context || self.currentState!.1.file.id != item.file.id {
|
||||||
if let dimensions = item.file.dimensions {
|
if let dimensions = item.file.dimensions {
|
||||||
if item.file.isAnimatedSticker || item.file.isVideoSticker {
|
if item.file.isAnimatedSticker || item.file.isVideoSticker {
|
||||||
let animationNode: AnimatedStickerNode
|
let animationNode: AnimatedStickerNode
|
||||||
@ -161,9 +162,9 @@ final class HorizontalStickerGridItemNode: GridItemNode {
|
|||||||
let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 160.0, height: 160.0))
|
let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 160.0, height: 160.0))
|
||||||
|
|
||||||
if item.file.isVideoSticker {
|
if item.file.isVideoSticker {
|
||||||
self.imageNode.setSignal(chatMessageSticker(postbox: account.postbox, userLocation: .other, file: item.file, small: true, synchronousLoad: false))
|
self.imageNode.setSignal(chatMessageSticker(postbox: context.account.postbox, userLocation: .other, file: item.file, small: true, synchronousLoad: false))
|
||||||
} else {
|
} else {
|
||||||
self.imageNode.setSignal(chatMessageAnimatedSticker(postbox: account.postbox, userLocation: .other, file: item.file, small: true, size: fittedDimensions, synchronousLoad: false))
|
self.imageNode.setSignal(chatMessageAnimatedSticker(postbox: context.account.postbox, userLocation: .other, file: item.file, small: true, size: fittedDimensions, synchronousLoad: false))
|
||||||
}
|
}
|
||||||
animationNode.started = { [weak self] in
|
animationNode.started = { [weak self] in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
@ -181,19 +182,19 @@ final class HorizontalStickerGridItemNode: GridItemNode {
|
|||||||
strongSelf.removePlaceholder(animated: false)
|
strongSelf.removePlaceholder(animated: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
animationNode.setup(source: AnimatedStickerResourceSource(account: account, resource: item.file.resource, isVideo: item.file.isVideoSticker), width: Int(fittedDimensions.width), height: Int(fittedDimensions.height), playbackMode: .loop, mode: .cached)
|
animationNode.setup(source: AnimatedStickerResourceSource(account: context.account, resource: item.file.resource, isVideo: item.file.isVideoSticker), width: Int(fittedDimensions.width), height: Int(fittedDimensions.height), playbackMode: .loop, mode: .cached)
|
||||||
|
|
||||||
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, userLocation: .other, fileReference: stickerPackFileReference(item.file), resource: item.file.resource).start())
|
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: context.account, userLocation: .other, fileReference: stickerPackFileReference(item.file), resource: item.file.resource).start())
|
||||||
} else {
|
} else {
|
||||||
self.imageNode.alpha = 1.0
|
self.imageNode.alpha = 1.0
|
||||||
self.imageNode.setSignal(chatMessageSticker(account: account, userLocation: .other, file: item.file, small: true))
|
self.imageNode.setSignal(chatMessageSticker(account: context.account, userLocation: .other, file: item.file, small: true))
|
||||||
|
|
||||||
if let currentAnimationNode = self.animationNode {
|
if let currentAnimationNode = self.animationNode {
|
||||||
self.animationNode = nil
|
self.animationNode = nil
|
||||||
currentAnimationNode.removeFromSupernode()
|
currentAnimationNode.removeFromSupernode()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, userLocation: .other, fileReference: stickerPackFileReference(item.file), resource: chatMessageStickerResource(file: item.file, small: true)).start())
|
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: context.account, userLocation: .other, fileReference: stickerPackFileReference(item.file), resource: chatMessageStickerResource(file: item.file, small: true)).start())
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.file.isPremiumSticker {
|
if item.file.isPremiumSticker {
|
||||||
@ -237,7 +238,7 @@ final class HorizontalStickerGridItemNode: GridItemNode {
|
|||||||
lockIconNode.removeFromSupernode()
|
lockIconNode.removeFromSupernode()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.currentState = (account, item, dimensions.cgSize)
|
self.currentState = (context, item, dimensions.cgSize)
|
||||||
self.setNeedsLayout()
|
self.setNeedsLayout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,8 +255,8 @@ final class HorizontalStickerGridItemNode: GridItemNode {
|
|||||||
if let placeholderNode = self.placeholderNode {
|
if let placeholderNode = self.placeholderNode {
|
||||||
placeholderNode.frame = bounds
|
placeholderNode.frame = bounds
|
||||||
|
|
||||||
if let theme = self.currentState?.1.theme, let file = self.currentState?.1.file {
|
if let context = self.currentState?.0, let theme = self.currentState?.1.theme, let file = self.currentState?.1.file {
|
||||||
placeholderNode.update(backgroundColor: theme.list.plainBackgroundColor, foregroundColor: theme.list.mediaPlaceholderColor.mixedWith(theme.list.plainBackgroundColor, alpha: 0.4), shimmeringColor: theme.list.mediaPlaceholderColor.withAlphaComponent(0.3), data: file.immediateThumbnailData, size: bounds.size)
|
placeholderNode.update(backgroundColor: theme.list.plainBackgroundColor, foregroundColor: theme.list.mediaPlaceholderColor.mixedWith(theme.list.plainBackgroundColor, alpha: 0.4), shimmeringColor: theme.list.mediaPlaceholderColor.withAlphaComponent(0.3), data: file.immediateThumbnailData, size: bounds.size, enableEffect: context.sharedContext.energyUsageSettings.fullTranslucency)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ private struct StickerEntry: Identifiable, Comparable {
|
|||||||
return lhs.index < rhs.index
|
return lhs.index < rhs.index
|
||||||
}
|
}
|
||||||
|
|
||||||
func item(account: Account, stickersInteraction: HorizontalStickersChatContextPanelInteraction, interfaceInteraction: ChatPanelInterfaceInteraction, theme: PresentationTheme) -> GridItem {
|
func item(context: AccountContext, stickersInteraction: HorizontalStickersChatContextPanelInteraction, interfaceInteraction: ChatPanelInterfaceInteraction, theme: PresentationTheme) -> GridItem {
|
||||||
return HorizontalStickerGridItem(account: account, file: self.file, theme: theme, isPreviewed: { item in
|
return HorizontalStickerGridItem(context: context, file: self.file, theme: theme, isPreviewed: { item in
|
||||||
return false//stickersInteraction.previewedStickerItem == item
|
return false//stickersInteraction.previewedStickerItem == item
|
||||||
}, sendSticker: { file, node, rect in
|
}, sendSticker: { file, node, rect in
|
||||||
let _ = interfaceInteraction.sendSticker(file, true, node, rect, nil, [])
|
let _ = interfaceInteraction.sendSticker(file, true, node, rect, nil, [])
|
||||||
@ -88,15 +88,15 @@ private struct StickerEntryTransition {
|
|||||||
let scrollToItem: GridNodeScrollToItem?
|
let scrollToItem: GridNodeScrollToItem?
|
||||||
}
|
}
|
||||||
|
|
||||||
private func preparedGridEntryTransition(account: Account, from fromEntries: [StickerEntry], to toEntries: [StickerEntry], stickersInteraction: HorizontalStickersChatContextPanelInteraction, interfaceInteraction: ChatPanelInterfaceInteraction, theme: PresentationTheme) -> StickerEntryTransition {
|
private func preparedGridEntryTransition(context: AccountContext, from fromEntries: [StickerEntry], to toEntries: [StickerEntry], stickersInteraction: HorizontalStickersChatContextPanelInteraction, interfaceInteraction: ChatPanelInterfaceInteraction, theme: PresentationTheme) -> StickerEntryTransition {
|
||||||
let stationaryItems: GridNodeStationaryItems = .none
|
let stationaryItems: GridNodeStationaryItems = .none
|
||||||
let scrollToItem: GridNodeScrollToItem? = nil
|
let scrollToItem: GridNodeScrollToItem? = nil
|
||||||
|
|
||||||
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
|
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
|
||||||
|
|
||||||
let deletions = deleteIndices
|
let deletions = deleteIndices
|
||||||
let insertions = indicesAndItems.map { GridNodeInsertItem(index: $0.0, item: $0.1.item(account: account, stickersInteraction: stickersInteraction, interfaceInteraction: interfaceInteraction, theme: theme), previousIndex: $0.2) }
|
let insertions = indicesAndItems.map { GridNodeInsertItem(index: $0.0, item: $0.1.item(context: context, stickersInteraction: stickersInteraction, interfaceInteraction: interfaceInteraction, theme: theme), previousIndex: $0.2) }
|
||||||
let updates = updateIndices.map { GridNodeUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(account: account, stickersInteraction: stickersInteraction, interfaceInteraction: interfaceInteraction, theme: theme)) }
|
let updates = updateIndices.map { GridNodeUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(context: context, stickersInteraction: stickersInteraction, interfaceInteraction: interfaceInteraction, theme: theme)) }
|
||||||
|
|
||||||
return StickerEntryTransition(deletions: deletions, insertions: insertions, updates: updates, updateFirstIndexInSectionOffset: nil, stationaryItems: stationaryItems, scrollToItem: scrollToItem)
|
return StickerEntryTransition(deletions: deletions, insertions: insertions, updates: updates, updateFirstIndexInSectionOffset: nil, stationaryItems: stationaryItems, scrollToItem: scrollToItem)
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ final class HorizontalStickersChatContextPanelNode: ChatInputContextPanelNode {
|
|||||||
self.updateLayout(size: validLayout.0, leftInset: validLayout.1, rightInset: validLayout.2, bottomInset: validLayout.3, transition: .immediate, interfaceState: validLayout.4)
|
self.updateLayout(size: validLayout.0, leftInset: validLayout.1, rightInset: validLayout.2, bottomInset: validLayout.3, transition: .immediate, interfaceState: validLayout.4)
|
||||||
}
|
}
|
||||||
|
|
||||||
let transition = preparedGridEntryTransition(account: self.context.account, from: previousEntries, to: entries, stickersInteraction: self.stickersInteraction, interfaceInteraction: self.interfaceInteraction!, theme: self.theme)
|
let transition = preparedGridEntryTransition(context: self.context, from: previousEntries, to: entries, stickersInteraction: self.stickersInteraction, interfaceInteraction: self.interfaceInteraction!, theme: self.theme)
|
||||||
self.enqueueTransition(transition)
|
self.enqueueTransition(transition)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ final class InChatPrefetchManager {
|
|||||||
|
|
||||||
init(context: AccountContext) {
|
init(context: AccountContext) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.settings = context.sharedContext.currentAutomaticMediaDownloadSettings.with { $0 }
|
self.settings = context.sharedContext.currentAutomaticMediaDownloadSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateAutoDownloadSettings(_ settings: MediaAutoDownloadSettings) {
|
func updateAutoDownloadSettings(_ settings: MediaAutoDownloadSettings) {
|
||||||
|
@ -431,7 +431,7 @@ private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollVie
|
|||||||
itemNode = current
|
itemNode = current
|
||||||
} else {
|
} else {
|
||||||
let item = HorizontalStickerGridItem(
|
let item = HorizontalStickerGridItem(
|
||||||
account: self.context.account,
|
context: self.context,
|
||||||
file: item.file,
|
file: item.file,
|
||||||
theme: self.theme,
|
theme: self.theme,
|
||||||
isPreviewed: { [weak self] item in
|
isPreviewed: { [weak self] item in
|
||||||
|
@ -131,7 +131,7 @@ private final class LargeEmojiActionSheetItemNode: ActionSheetItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let immediateThumbnailData = file.immediateThumbnailData {
|
if let immediateThumbnailData = file.immediateThumbnailData {
|
||||||
self.placeholderNode.update(backgroundColor: nil, foregroundColor: theme.secondaryTextColor.blitOver(theme.itemBackgroundColor, alpha: 0.55), shimmeringColor: theme.itemBackgroundColor.withAlphaComponent(0.4), data: immediateThumbnailData, size: CGSize(width: 96.0, height: 96.0), imageSize: dimensions.cgSize)
|
self.placeholderNode.update(backgroundColor: nil, foregroundColor: theme.secondaryTextColor.blitOver(theme.itemBackgroundColor, alpha: 0.55), shimmeringColor: theme.itemBackgroundColor.withAlphaComponent(0.4), data: immediateThumbnailData, size: CGSize(width: 96.0, height: 96.0), enableEffect: context.sharedContext.energyUsageSettings.fullTranslucency, imageSize: dimensions.cgSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,14 +146,14 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
public let currentInAppNotificationSettings: Atomic<InAppNotificationSettings>
|
public let currentInAppNotificationSettings: Atomic<InAppNotificationSettings>
|
||||||
private var inAppNotificationSettingsDisposable: Disposable?
|
private var inAppNotificationSettingsDisposable: Disposable?
|
||||||
|
|
||||||
public let currentAutomaticMediaDownloadSettings: Atomic<MediaAutoDownloadSettings>
|
public var currentAutomaticMediaDownloadSettings: MediaAutoDownloadSettings
|
||||||
private let _automaticMediaDownloadSettings = Promise<MediaAutoDownloadSettings>()
|
private let _automaticMediaDownloadSettings = Promise<MediaAutoDownloadSettings>()
|
||||||
public var automaticMediaDownloadSettings: Signal<MediaAutoDownloadSettings, NoError> {
|
public var automaticMediaDownloadSettings: Signal<MediaAutoDownloadSettings, NoError> {
|
||||||
return self._automaticMediaDownloadSettings.get()
|
return self._automaticMediaDownloadSettings.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
public var energyUsageSettings: EnergyUsageSettings {
|
public var energyUsageSettings: EnergyUsageSettings {
|
||||||
return self.currentAutomaticMediaDownloadSettings.with({ $0 }).energyUsageSettings
|
return self.currentAutomaticMediaDownloadSettings.energyUsageSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
public let currentAutodownloadSettings: Atomic<AutodownloadSettings>
|
public let currentAutodownloadSettings: Atomic<AutodownloadSettings>
|
||||||
@ -234,7 +234,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self._currentPresentationData = Atomic(value: initialPresentationDataAndSettings.presentationData)
|
self._currentPresentationData = Atomic(value: initialPresentationDataAndSettings.presentationData)
|
||||||
self.currentAutomaticMediaDownloadSettings = Atomic(value: initialPresentationDataAndSettings.automaticMediaDownloadSettings)
|
self.currentAutomaticMediaDownloadSettings = initialPresentationDataAndSettings.automaticMediaDownloadSettings
|
||||||
self.currentAutodownloadSettings = Atomic(value: initialPresentationDataAndSettings.autodownloadSettings)
|
self.currentAutodownloadSettings = Atomic(value: initialPresentationDataAndSettings.autodownloadSettings)
|
||||||
self.currentMediaInputSettings = Atomic(value: initialPresentationDataAndSettings.mediaInputSettings)
|
self.currentMediaInputSettings = Atomic(value: initialPresentationDataAndSettings.mediaInputSettings)
|
||||||
self.currentInAppNotificationSettings = Atomic(value: initialPresentationDataAndSettings.inAppNotificationSettings)
|
self.currentInAppNotificationSettings = Atomic(value: initialPresentationDataAndSettings.inAppNotificationSettings)
|
||||||
@ -367,7 +367,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
|
|
||||||
self.automaticMediaDownloadSettingsDisposable.set(self._automaticMediaDownloadSettings.get().start(next: { [weak self] next in
|
self.automaticMediaDownloadSettingsDisposable.set(self._automaticMediaDownloadSettings.get().start(next: { [weak self] next in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let _ = strongSelf.currentAutomaticMediaDownloadSettings.swap(next)
|
strongSelf.currentAutomaticMediaDownloadSettings = next
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ private final class FeaturedPackItemNode: ListViewItemNode {
|
|||||||
immediateThumbnailData = data
|
immediateThumbnailData = data
|
||||||
}
|
}
|
||||||
|
|
||||||
placeholderNode.update(backgroundColor: theme.chat.inputMediaPanel.stickersBackgroundColor.withAlphaComponent(1.0), foregroundColor: theme.chat.inputMediaPanel.stickersSectionTextColor.blitOver(theme.chat.inputMediaPanel.stickersBackgroundColor, alpha: 0.15), shimmeringColor: theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.3), data: immediateThumbnailData, size: boundingImageSize, imageSize: imageSize.cgSize)
|
placeholderNode.update(backgroundColor: theme.chat.inputMediaPanel.stickersBackgroundColor.withAlphaComponent(1.0), foregroundColor: theme.chat.inputMediaPanel.stickersSectionTextColor.blitOver(theme.chat.inputMediaPanel.stickersBackgroundColor, alpha: 0.15), shimmeringColor: theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.3), data: immediateThumbnailData, size: boundingImageSize, enableEffect: true, imageSize: imageSize.cgSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.containerNode.frame = CGRect(origin: CGPoint(), size: boundingSize)
|
self.containerNode.frame = CGRect(origin: CGPoint(), size: boundingSize)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user