Various improvements

This commit is contained in:
Ilya Laktyushin 2022-05-22 01:05:56 +04:00
parent 1dde73148a
commit b0396c8d15
10 changed files with 68 additions and 19 deletions

View File

@ -226,6 +226,8 @@ final class PeekControllerNode: ViewControllerTracingNode {
} }
func animateOut(to rect: CGRect, completion: @escaping () -> Void) { 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.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.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) self.darkDimNode.layer.animateAlpha(from: self.darkDimNode.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false)

View File

@ -33,6 +33,7 @@ swift_library(
"//submodules/ContextUI:ContextUI", "//submodules/ContextUI:ContextUI",
"//submodules/MoreButtonNode:MoreButtonNode", "//submodules/MoreButtonNode:MoreButtonNode",
"//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode", "//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode",
"//submodules/PremiumUI:PremiumUI",
], ],
visibility = [ visibility = [
"//visibility:public", "//visibility:public",

View File

@ -14,6 +14,7 @@ import ContextUI
import MoreButtonNode import MoreButtonNode
import UndoUI import UndoUI
import ShareController import ShareController
import PremiumUI
private enum StickerPackPreviewGridEntry: Comparable, Identifiable { private enum StickerPackPreviewGridEntry: Comparable, Identifiable {
case sticker(index: Int, stableId: Int, stickerItem: StickerPackItem?, isEmpty: Bool, isPremium: Bool, isLocked: Bool) 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 { } else {
return nil return nil

View File

@ -152,7 +152,7 @@ public final class StickerPreviewPeekContentNode: ASDisplayNode, PeekControllerC
if isPremiumSticker { if isPremiumSticker {
animationNode.completed = { [weak self] _ in animationNode.completed = { [weak self] _ in
if let strongSelf = self, let animationNode = strongSelf.animationNode, let additionalAnimationNode = strongSelf.additionalAnimationNode { if let strongSelf = self, let animationNode = strongSelf.animationNode, let additionalAnimationNode = strongSelf.additionalAnimationNode {
Queue.mainQueue().after(0.5, { Queue.mainQueue().after(0.1, {
animationNode.play() animationNode.play()
additionalAnimationNode.play() additionalAnimationNode.play()
}) })
@ -250,6 +250,7 @@ final class PremiumStickerPackAccessoryNode: SparseNode, PeekControllerAccessory
self.addSubnode(self.cancelButton) self.addSubnode(self.cancelButton)
self.proceedButton.pressed = { [weak self] in self.proceedButton.pressed = { [weak self] in
self?.dismiss()
self?.proceed() self?.proceed()
} }
self.cancelButton.addTarget(self, action: #selector(self.cancelPressed), forControlEvents: .touchUpInside) self.cancelButton.addTarget(self, action: #selector(self.cancelPressed), forControlEvents: .touchUpInside)

View File

@ -20,6 +20,7 @@ import PresentationDataUtils
import ChatInterfaceState import ChatInterfaceState
import ChatPresentationInterfaceState import ChatPresentationInterfaceState
import UndoUI import UndoUI
import PremiumUI
struct PeerSpecificPackData { struct PeerSpecificPackData {
let peer: Peer 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 { } else {
return nil 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 { } else {
return nil return nil

View File

@ -15,6 +15,7 @@ import PresentationDataUtils
import SearchBarNode import SearchBarNode
import UndoUI import UndoUI
import ContextUI import ContextUI
import PremiumUI
private final class FeaturedInteraction { private final class FeaturedInteraction {
let installPack: (ItemCollectionInfo, Bool) -> Void 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 { } else {
return nil 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 { } else {
return nil return nil

View File

@ -13,6 +13,7 @@ import StickerPackPreviewUI
import ContextUI import ContextUI
import ChatPresentationInterfaceState import ChatPresentationInterfaceState
import UndoUI import UndoUI
import PremiumUI
private struct ChatContextResultStableId: Hashable { private struct ChatContextResultStableId: Hashable {
let result: ChatContextResult 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 { } else {
var menuItems: [ContextMenuItem] = [] var menuItems: [ContextMenuItem] = []

View File

@ -12,6 +12,7 @@ import AccountContext
import StickerPackPreviewUI import StickerPackPreviewUI
import ContextUI import ContextUI
import ChatPresentationInterfaceState import ChatPresentationInterfaceState
import PremiumUI
final class HorizontalStickersChatContextPanelInteraction { final class HorizontalStickersChatContextPanelInteraction {
var previewedStickerItem: StickerPackItem? 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 { } else {
return nil return nil

View File

@ -11,6 +11,7 @@ import AccountContext
import StickerPackPreviewUI import StickerPackPreviewUI
import ContextUI import ContextUI
import ChatPresentationInterfaceState import ChatPresentationInterfaceState
import PremiumUI
private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollViewDelegate { private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollViewDelegate {
private final class DisplayItem { 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 { } else {
return nil return nil

View File

@ -12,6 +12,7 @@ import AccountContext
import StickerPackPreviewUI import StickerPackPreviewUI
import ContextUI import ContextUI
import ChatPresentationInterfaceState import ChatPresentationInterfaceState
import PremiumUI
private struct StickersChatInputContextPanelEntryStableId: Hashable { private struct StickersChatInputContextPanelEntryStableId: Hashable {
let ids: [MediaId] 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 { } else {
return nil return nil