diff --git a/submodules/ContextUI/Sources/PeekControllerNode.swift b/submodules/ContextUI/Sources/PeekControllerNode.swift index 1895dd2955..d53a35f73a 100644 --- a/submodules/ContextUI/Sources/PeekControllerNode.swift +++ b/submodules/ContextUI/Sources/PeekControllerNode.swift @@ -226,6 +226,8 @@ final class PeekControllerNode: ViewControllerTracingNode { } func animateOut(to rect: CGRect, completion: @escaping () -> Void) { + self.isUserInteractionEnabled = false + self.dimNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false) self.blurView.layer.animateAlpha(from: self.blurView.alpha, to: 0.0, duration: 0.25, removeOnCompletion: false) self.darkDimNode.layer.animateAlpha(from: self.darkDimNode.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false) diff --git a/submodules/StickerPackPreviewUI/BUILD b/submodules/StickerPackPreviewUI/BUILD index 95647b27ae..827381143e 100644 --- a/submodules/StickerPackPreviewUI/BUILD +++ b/submodules/StickerPackPreviewUI/BUILD @@ -33,6 +33,7 @@ swift_library( "//submodules/ContextUI:ContextUI", "//submodules/MoreButtonNode:MoreButtonNode", "//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode", + "//submodules/PremiumUI:PremiumUI", ], visibility = [ "//visibility:public", diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift index 6e8f290fbb..2ee48230b5 100644 --- a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift +++ b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift @@ -14,6 +14,7 @@ import ContextUI import MoreButtonNode import UndoUI import ShareController +import PremiumUI private enum StickerPackPreviewGridEntry: Comparable, Identifiable { case sticker(index: Int, stableId: Int, stickerItem: StickerPackItem?, isEmpty: Bool, isPremium: Bool, isLocked: Bool) @@ -369,8 +370,14 @@ private final class StickerPackContainer: ASDisplayNode { } }))) } - return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, item: .pack(item), isLocked: item.file.isPremiumSticker && !hasPremium, menu: menuItems, openPremiumIntro: { - + return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, item: .pack(item), isLocked: item.file.isPremiumSticker && !hasPremium, menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + let navigationController = strongSelf.controller?.parentNavigationController + strongSelf.controller?.dismiss(animated: false, completion: nil) + navigationController?.pushViewController(controller) })) } else { return nil diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPreviewPeekContent.swift b/submodules/StickerPackPreviewUI/Sources/StickerPreviewPeekContent.swift index 022e2a5bd6..5f53499926 100644 --- a/submodules/StickerPackPreviewUI/Sources/StickerPreviewPeekContent.swift +++ b/submodules/StickerPackPreviewUI/Sources/StickerPreviewPeekContent.swift @@ -152,7 +152,7 @@ public final class StickerPreviewPeekContentNode: ASDisplayNode, PeekControllerC if isPremiumSticker { animationNode.completed = { [weak self] _ in if let strongSelf = self, let animationNode = strongSelf.animationNode, let additionalAnimationNode = strongSelf.additionalAnimationNode { - Queue.mainQueue().after(0.5, { + Queue.mainQueue().after(0.1, { animationNode.play() additionalAnimationNode.play() }) @@ -250,6 +250,7 @@ final class PremiumStickerPackAccessoryNode: SparseNode, PeekControllerAccessory self.addSubnode(self.cancelButton) self.proceedButton.pressed = { [weak self] in + self?.dismiss() self?.proceed() } self.cancelButton.addTarget(self, action: #selector(self.cancelPressed), forControlEvents: .touchUpInside) diff --git a/submodules/TelegramUI/Sources/ChatMediaInputNode.swift b/submodules/TelegramUI/Sources/ChatMediaInputNode.swift index 845131605f..2e14643dbd 100644 --- a/submodules/TelegramUI/Sources/ChatMediaInputNode.swift +++ b/submodules/TelegramUI/Sources/ChatMediaInputNode.swift @@ -20,6 +20,7 @@ import PresentationDataUtils import ChatInterfaceState import ChatPresentationInterfaceState import UndoUI +import PremiumUI struct PeerSpecificPackData { let peer: Peer @@ -1617,8 +1618,12 @@ final class ChatMediaInputNode: ChatInputNode { } } }))) - return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: item, menu: menuItems, openPremiumIntro: { - + return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: item, menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + strongSelf.controllerInteraction.navigationController()?.pushViewController(controller) })) } else { return nil @@ -1745,8 +1750,12 @@ final class ChatMediaInputNode: ChatInputNode { } })) ) - return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .pack(item), isLocked: item.file.isPremiumSticker && !hasPremium, menu: menuItems, openPremiumIntro: { - + return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .pack(item), isLocked: item.file.isPremiumSticker && !hasPremium, menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + strongSelf.controllerInteraction.navigationController()?.pushViewController(controller) })) } else { return nil diff --git a/submodules/TelegramUI/Sources/FeaturedStickersScreen.swift b/submodules/TelegramUI/Sources/FeaturedStickersScreen.swift index c5aa863376..d307e14ae4 100644 --- a/submodules/TelegramUI/Sources/FeaturedStickersScreen.swift +++ b/submodules/TelegramUI/Sources/FeaturedStickersScreen.swift @@ -15,6 +15,7 @@ import PresentationDataUtils import SearchBarNode import UndoUI import ContextUI +import PremiumUI private final class FeaturedInteraction { let installPack: (ItemCollectionInfo, Bool) -> Void @@ -531,8 +532,12 @@ private final class FeaturedStickersScreenNode: ViewControllerTracingNode { } })) ] - return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, item: item, menu: menuItems, openPremiumIntro: { - + return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, item: item, menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + strongSelf.controller?.push(controller) })) } else { return nil @@ -597,8 +602,12 @@ private final class FeaturedStickersScreenNode: ViewControllerTracingNode { } })) ] - return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, item: .pack(item), menu: menuItems, openPremiumIntro: { - + return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, item: .pack(item), menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + strongSelf.controller?.push(controller) })) } else { return nil diff --git a/submodules/TelegramUI/Sources/HorizontalListContextResultsChatInputContextPanelNode.swift b/submodules/TelegramUI/Sources/HorizontalListContextResultsChatInputContextPanelNode.swift index 3402e0effb..58d680b1a9 100644 --- a/submodules/TelegramUI/Sources/HorizontalListContextResultsChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/Sources/HorizontalListContextResultsChatInputContextPanelNode.swift @@ -13,6 +13,7 @@ import StickerPackPreviewUI import ContextUI import ChatPresentationInterfaceState import UndoUI +import PremiumUI private struct ChatContextResultStableId: Hashable { let result: ChatContextResult @@ -174,8 +175,12 @@ final class HorizontalListContextResultsChatInputContextPanelNode: ChatInputCont } }))) } - selectedItemNodeAndContent = (itemNode, StickerPreviewPeekContent(account: item.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .found(FoundStickerItem(file: file, stringRepresentations: [])), menu: menuItems, openPremiumIntro: { - + selectedItemNodeAndContent = (itemNode, StickerPreviewPeekContent(account: item.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .found(FoundStickerItem(file: file, stringRepresentations: [])), menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + strongSelf.interfaceInteraction?.getNavigationController()?.pushViewController(controller) })) } else { var menuItems: [ContextMenuItem] = [] diff --git a/submodules/TelegramUI/Sources/HorizontalStickersChatContextPanelNode.swift b/submodules/TelegramUI/Sources/HorizontalStickersChatContextPanelNode.swift index 39aa0c3c87..66568e6094 100755 --- a/submodules/TelegramUI/Sources/HorizontalStickersChatContextPanelNode.swift +++ b/submodules/TelegramUI/Sources/HorizontalStickersChatContextPanelNode.swift @@ -12,6 +12,7 @@ import AccountContext import StickerPackPreviewUI import ContextUI import ChatPresentationInterfaceState +import PremiumUI final class HorizontalStickersChatContextPanelInteraction { var previewedStickerItem: StickerPackItem? @@ -220,8 +221,12 @@ final class HorizontalStickersChatContextPanelNode: ChatInputContextPanelNode { } })) ] - return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .pack(item), menu: menuItems, openPremiumIntro: { - + return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .pack(item), menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + strongSelf.controllerInteraction?.navigationController()?.pushViewController(controller) })) } else { return nil diff --git a/submodules/TelegramUI/Sources/InlineReactionSearchPanel.swift b/submodules/TelegramUI/Sources/InlineReactionSearchPanel.swift index b473dd3732..6b1059f4e0 100644 --- a/submodules/TelegramUI/Sources/InlineReactionSearchPanel.swift +++ b/submodules/TelegramUI/Sources/InlineReactionSearchPanel.swift @@ -11,6 +11,7 @@ import AccountContext import StickerPackPreviewUI import ContextUI import ChatPresentationInterfaceState +import PremiumUI private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollViewDelegate { private final class DisplayItem { @@ -175,8 +176,12 @@ private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollVie } })) ) - return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .pack(item), menu: menuItems, openPremiumIntro: { - + return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .pack(item), menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self, let controllerInteraction = strongSelf.getControllerInteraction?() else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + controllerInteraction.navigationController()?.pushViewController(controller) })) } else { return nil diff --git a/submodules/TelegramUI/Sources/StickersChatInputContextPanelNode.swift b/submodules/TelegramUI/Sources/StickersChatInputContextPanelNode.swift index 26831d0301..0f16daeb27 100644 --- a/submodules/TelegramUI/Sources/StickersChatInputContextPanelNode.swift +++ b/submodules/TelegramUI/Sources/StickersChatInputContextPanelNode.swift @@ -12,6 +12,7 @@ import AccountContext import StickerPackPreviewUI import ContextUI import ChatPresentationInterfaceState +import PremiumUI private struct StickersChatInputContextPanelEntryStableId: Hashable { let ids: [MediaId] @@ -176,8 +177,12 @@ final class StickersChatInputContextPanelNode: ChatInputContextPanelNode { } })) ] - return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .pack(item), menu: menuItems, openPremiumIntro: { - + return (itemNode, StickerPreviewPeekContent(account: strongSelf.context.account, theme: strongSelf.theme, strings: strongSelf.strings, item: .pack(item), menu: menuItems, openPremiumIntro: { [weak self] in + guard let strongSelf = self else { + return + } + let controller = PremiumIntroScreen(context: strongSelf.context, source: .stickers) + strongSelf.controllerInteraction?.navigationController()?.pushViewController(controller) })) } else { return nil