mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
@@ -2257,6 +2257,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
public var reactionsTitle: String?
|
||||
public var animationCache: AnimationCache?
|
||||
public var alwaysAllowPremiumReactions: Bool
|
||||
public var allPresetReactionsAreAvailable: Bool
|
||||
public var getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?
|
||||
public var disablePositionLock: Bool
|
||||
public var tip: Tip?
|
||||
@@ -2272,6 +2273,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
reactionsTitle: String? = nil,
|
||||
animationCache: AnimationCache? = nil,
|
||||
alwaysAllowPremiumReactions: Bool = false,
|
||||
allPresetReactionsAreAvailable: Bool = false,
|
||||
getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)? = nil,
|
||||
disablePositionLock: Bool = false,
|
||||
tip: Tip? = nil,
|
||||
@@ -2286,6 +2288,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
self.selectedReactionItems = selectedReactionItems
|
||||
self.reactionsTitle = reactionsTitle
|
||||
self.alwaysAllowPremiumReactions = alwaysAllowPremiumReactions
|
||||
self.allPresetReactionsAreAvailable = allPresetReactionsAreAvailable
|
||||
self.getEmojiContent = getEmojiContent
|
||||
self.disablePositionLock = disablePositionLock
|
||||
self.tip = tip
|
||||
@@ -2301,6 +2304,7 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
self.selectedReactionItems = Set()
|
||||
self.reactionsTitle = nil
|
||||
self.alwaysAllowPremiumReactions = false
|
||||
self.allPresetReactionsAreAvailable = false
|
||||
self.getEmojiContent = nil
|
||||
self.disablePositionLock = false
|
||||
self.tip = nil
|
||||
|
||||
@@ -35,6 +35,28 @@ public protocol ContextControllerActionsStackItemNode: ASDisplayNode {
|
||||
func increaseHighlightedIndex()
|
||||
}
|
||||
|
||||
public struct ContextControllerReactionItems {
|
||||
public var context: AccountContext
|
||||
public var reactionItems: [ReactionContextItem]
|
||||
public var selectedReactionItems: Set<MessageReaction.Reaction>
|
||||
public var reactionsTitle: String?
|
||||
public var animationCache: AnimationCache
|
||||
public var alwaysAllowPremiumReactions: Bool
|
||||
public var allPresetReactionsAreAvailable: Bool
|
||||
public var getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?
|
||||
|
||||
public init(context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, allPresetReactionsAreAvailable: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?) {
|
||||
self.context = context
|
||||
self.reactionItems = reactionItems
|
||||
self.selectedReactionItems = selectedReactionItems
|
||||
self.reactionsTitle = reactionsTitle
|
||||
self.animationCache = animationCache
|
||||
self.alwaysAllowPremiumReactions = alwaysAllowPremiumReactions
|
||||
self.allPresetReactionsAreAvailable = allPresetReactionsAreAvailable
|
||||
self.getEmojiContent = getEmojiContent
|
||||
}
|
||||
}
|
||||
|
||||
public protocol ContextControllerActionsStackItem: AnyObject {
|
||||
func node(
|
||||
getController: @escaping () -> ContextControllerProtocol?,
|
||||
@@ -46,7 +68,7 @@ public protocol ContextControllerActionsStackItem: AnyObject {
|
||||
var id: AnyHashable? { get }
|
||||
var tip: ContextController.Tip? { get }
|
||||
var tipSignal: Signal<ContextController.Tip?, NoError>? { get }
|
||||
var reactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)? { get }
|
||||
var reactionItems: ContextControllerReactionItems? { get }
|
||||
var dismissed: (() -> Void)? { get }
|
||||
}
|
||||
|
||||
@@ -911,7 +933,7 @@ final class ContextControllerActionsListStackItem: ContextControllerActionsStack
|
||||
|
||||
let id: AnyHashable?
|
||||
let items: [ContextMenuItem]
|
||||
let reactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)?
|
||||
let reactionItems: ContextControllerReactionItems?
|
||||
let tip: ContextController.Tip?
|
||||
let tipSignal: Signal<ContextController.Tip?, NoError>?
|
||||
let dismissed: (() -> Void)?
|
||||
@@ -919,7 +941,7 @@ final class ContextControllerActionsListStackItem: ContextControllerActionsStack
|
||||
init(
|
||||
id: AnyHashable?,
|
||||
items: [ContextMenuItem],
|
||||
reactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)?,
|
||||
reactionItems: ContextControllerReactionItems?,
|
||||
tip: ContextController.Tip?,
|
||||
tipSignal: Signal<ContextController.Tip?, NoError>?,
|
||||
dismissed: (() -> Void)?
|
||||
@@ -1009,7 +1031,7 @@ final class ContextControllerActionsCustomStackItem: ContextControllerActionsSta
|
||||
|
||||
let id: AnyHashable?
|
||||
private let content: ContextControllerItemsContent
|
||||
let reactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)?
|
||||
let reactionItems: ContextControllerReactionItems?
|
||||
let tip: ContextController.Tip?
|
||||
let tipSignal: Signal<ContextController.Tip?, NoError>?
|
||||
let dismissed: (() -> Void)?
|
||||
@@ -1017,7 +1039,7 @@ final class ContextControllerActionsCustomStackItem: ContextControllerActionsSta
|
||||
init(
|
||||
id: AnyHashable?,
|
||||
content: ContextControllerItemsContent,
|
||||
reactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)?,
|
||||
reactionItems: ContextControllerReactionItems?,
|
||||
tip: ContextController.Tip?,
|
||||
tipSignal: Signal<ContextController.Tip?, NoError>?,
|
||||
dismissed: (() -> Void)?
|
||||
@@ -1046,9 +1068,18 @@ final class ContextControllerActionsCustomStackItem: ContextControllerActionsSta
|
||||
}
|
||||
|
||||
func makeContextControllerActionsStackItem(items: ContextController.Items) -> [ContextControllerActionsStackItem] {
|
||||
var reactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)?
|
||||
var reactionItems: ContextControllerReactionItems?
|
||||
if let context = items.context, let animationCache = items.animationCache, !items.reactionItems.isEmpty {
|
||||
reactionItems = (context, items.reactionItems, items.selectedReactionItems, reactionsTitle: items.reactionsTitle, animationCache, alwaysAllowPremiumReactions: items.alwaysAllowPremiumReactions, items.getEmojiContent)
|
||||
reactionItems = ContextControllerReactionItems(
|
||||
context: context,
|
||||
reactionItems: items.reactionItems,
|
||||
selectedReactionItems: items.selectedReactionItems,
|
||||
reactionsTitle: items.reactionsTitle,
|
||||
animationCache: animationCache,
|
||||
alwaysAllowPremiumReactions: items.alwaysAllowPremiumReactions,
|
||||
allPresetReactionsAreAvailable: items.allPresetReactionsAreAvailable,
|
||||
getEmojiContent: items.getEmojiContent
|
||||
)
|
||||
}
|
||||
switch items.content {
|
||||
case let .list(listItems):
|
||||
@@ -1172,7 +1203,7 @@ final class ContextControllerActionsStackNode: ASDisplayNode {
|
||||
var tip: ContextController.Tip?
|
||||
let tipSignal: Signal<ContextController.Tip?, NoError>?
|
||||
var tipNode: InnerTextSelectionTipContainerNode?
|
||||
let reactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)?
|
||||
let reactionItems: ContextControllerReactionItems?
|
||||
let itemDismissed: (() -> Void)?
|
||||
var storedScrollingState: CGFloat?
|
||||
let positionLock: CGFloat?
|
||||
@@ -1187,7 +1218,7 @@ final class ContextControllerActionsStackNode: ASDisplayNode {
|
||||
item: ContextControllerActionsStackItem,
|
||||
tip: ContextController.Tip?,
|
||||
tipSignal: Signal<ContextController.Tip?, NoError>?,
|
||||
reactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)?,
|
||||
reactionItems: ContextControllerReactionItems?,
|
||||
itemDismissed: (() -> Void)?,
|
||||
positionLock: CGFloat?
|
||||
) {
|
||||
@@ -1338,7 +1369,7 @@ final class ContextControllerActionsStackNode: ASDisplayNode {
|
||||
|
||||
private var selectionPanGesture: UIPanGestureRecognizer?
|
||||
|
||||
var topReactionItems: (context: AccountContext, reactionItems: [ReactionContextItem], selectedReactionItems: Set<MessageReaction.Reaction>, reactionsTitle: String?, animationCache: AnimationCache, alwaysAllowPremiumReactions: Bool, getEmojiContent: ((AnimationCache, MultiAnimationRenderer) -> Signal<EmojiPagerContentComponent, NoError>)?)? {
|
||||
var topReactionItems: ContextControllerReactionItems? {
|
||||
return self.itemContainers.last?.reactionItems
|
||||
}
|
||||
|
||||
|
||||
@@ -650,6 +650,7 @@ final class ContextControllerExtractedPresentationNode: ASDisplayNode, ContextCo
|
||||
selectedItems: reactionItems.selectedReactionItems,
|
||||
title: reactionItems.reactionsTitle,
|
||||
alwaysAllowPremiumReactions: reactionItems.alwaysAllowPremiumReactions,
|
||||
allPresetReactionsAreAvailable: reactionItems.allPresetReactionsAreAvailable,
|
||||
getEmojiContent: reactionItems.getEmojiContent,
|
||||
isExpandedUpdated: { [weak self] transition in
|
||||
guard let strongSelf = self else {
|
||||
|
||||
Reference in New Issue
Block a user