Chat-specific theme improvements

This commit is contained in:
Ilya Laktyushin
2021-09-04 00:39:56 +03:00
parent 60c51d8008
commit 79ecba19b0
64 changed files with 510 additions and 359 deletions

View File

@@ -12,6 +12,7 @@ import StickerResources
import AlertUI
import PresentationDataUtils
import UndoUI
import TelegramPresentationData
public enum StickerPackPreviewControllerMode {
case `default`
@@ -44,6 +45,7 @@ public final class StickerPackPreviewController: ViewController, StandalonePrese
private let openMentionDisposable = MetaDisposable()
private var presentationData: PresentationData
private var presentationDataDisposable: Disposable?
public var sendSticker: ((FileMediaReference, ASDisplayNode, CGRect) -> Bool)? {
@@ -67,7 +69,7 @@ public final class StickerPackPreviewController: ViewController, StandalonePrese
private let actionPerformed: ((StickerPackCollectionInfo, [ItemCollectionItem], StickerPackScreenPerformedAction) -> Void)?
public init(context: AccountContext, stickerPack: StickerPackReference, mode: StickerPackPreviewControllerMode = .default, parentNavigationController: NavigationController?, actionPerformed: ((StickerPackCollectionInfo, [ItemCollectionItem], StickerPackScreenPerformedAction) -> Void)? = nil) {
public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, stickerPack: StickerPackReference, mode: StickerPackPreviewControllerMode = .default, parentNavigationController: NavigationController?, actionPerformed: ((StickerPackCollectionInfo, [ItemCollectionItem], StickerPackScreenPerformedAction) -> Void)? = nil) {
self.context = context
self.mode = mode
self.parentNavigationController = parentNavigationController
@@ -75,6 +77,8 @@ public final class StickerPackPreviewController: ViewController, StandalonePrese
self.stickerPack = stickerPack
self.presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
super.init(navigationBarPresentationData: nil)
self.blocksBackgroundWhenInOverlay = true
@@ -83,9 +87,10 @@ public final class StickerPackPreviewController: ViewController, StandalonePrese
self.stickerPackContents.set(context.engine.stickers.loadedStickerPack(reference: stickerPack, forceActualized: true))
self.presentationDataDisposable = (context.sharedContext.presentationData
self.presentationDataDisposable = ((updatedPresentationData?.signal ?? context.sharedContext.presentationData)
|> deliverOnMainQueue).start(next: { [weak self] presentationData in
if let strongSelf = self, strongSelf.isNodeLoaded {
strongSelf.presentationData = presentationData
strongSelf.controllerNode.updatePresentationData(presentationData)
}
})
@@ -125,7 +130,7 @@ public final class StickerPackPreviewController: ViewController, StandalonePrese
}
}
}
self.displayNode = StickerPackPreviewControllerNode(context: self.context, openShare: openShareImpl, openMention: { [weak self] mention in
self.displayNode = StickerPackPreviewControllerNode(context: self.context, presentationData: self.presentationData, openShare: openShareImpl, openMention: { [weak self] mention in
guard let strongSelf = self else {
return
}