mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Channel reaction improvements
This commit is contained in:
@@ -112,6 +112,10 @@ extension ChatControllerImpl {
|
||||
actions.reactionItems = topReactions.map(ReactionContextItem.reaction)
|
||||
actions.selectedReactionItems = selectedReactions.reactions
|
||||
|
||||
if let channel = self.presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
actions.alwaysAllowPremiumReactions = true
|
||||
}
|
||||
|
||||
if !actions.reactionItems.isEmpty {
|
||||
let reactionItems: [EmojiComponentReactionItem] = actions.reactionItems.compactMap { item -> EmojiComponentReactionItem? in
|
||||
switch item {
|
||||
@@ -150,7 +154,7 @@ extension ChatControllerImpl {
|
||||
animationCache: animationCache,
|
||||
animationRenderer: animationRenderer,
|
||||
isStandalone: false,
|
||||
subject: .reaction,
|
||||
subject: .reaction(onlyTop: false),
|
||||
hasTrending: false,
|
||||
topReactionItems: reactionItems,
|
||||
areUnicodeEmojiEnabled: false,
|
||||
@@ -159,6 +163,26 @@ extension ChatControllerImpl {
|
||||
selectedItems: selectedReactions.files
|
||||
)
|
||||
}
|
||||
} else if reactionItems.count > 10 {
|
||||
actions.getEmojiContent = { [weak self] animationCache, animationRenderer in
|
||||
guard let self else {
|
||||
preconditionFailure()
|
||||
}
|
||||
|
||||
return EmojiPagerContentComponent.emojiInputData(
|
||||
context: self.context,
|
||||
animationCache: animationCache,
|
||||
animationRenderer: animationRenderer,
|
||||
isStandalone: false,
|
||||
subject: .reaction(onlyTop: true),
|
||||
hasTrending: false,
|
||||
topReactionItems: reactionItems,
|
||||
areUnicodeEmojiEnabled: false,
|
||||
areCustomEmojiEnabled: false,
|
||||
chatPeerId: self.chatLocation.peerId,
|
||||
selectedItems: selectedReactions.files
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,9 +356,12 @@ extension ChatControllerImpl {
|
||||
}*/
|
||||
|
||||
if removedReaction == nil, case .custom = chosenReaction {
|
||||
if !self.presentationInterfaceState.isPremium {
|
||||
controller?.premiumReactionsSelected?()
|
||||
return
|
||||
if let peer = self.presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, case .broadcast = peer.info {
|
||||
} else {
|
||||
if !self.presentationInterfaceState.isPremium {
|
||||
controller?.premiumReactionsSelected?()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user