mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Reaction improvements
This commit is contained in:
@@ -29,15 +29,19 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
|
||||
init() {
|
||||
self.highlightBackgroundNode = ASDisplayNode()
|
||||
self.highlightBackgroundNode.isAccessibilityElement = false
|
||||
self.highlightBackgroundNode.alpha = 0.0
|
||||
|
||||
self.titleLabelNode = ImmediateTextNode()
|
||||
self.titleLabelNode.isAccessibilityElement = false
|
||||
self.titleLabelNode.maximumNumberOfLines = 1
|
||||
self.titleLabelNode.isUserInteractionEnabled = false
|
||||
|
||||
self.iconNode = ASImageNode()
|
||||
self.iconNode.isAccessibilityElement = false
|
||||
|
||||
self.separatorNode = ASDisplayNode()
|
||||
self.separatorNode.isAccessibilityElement = false
|
||||
|
||||
super.init()
|
||||
|
||||
@@ -46,6 +50,8 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
self.addSubnode(self.titleLabelNode)
|
||||
self.addSubnode(self.iconNode)
|
||||
|
||||
self.isAccessibilityElement = true
|
||||
|
||||
self.highligthedChanged = { [weak self] highlighted in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
@@ -74,6 +80,8 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
if self.theme !== presentationData.theme {
|
||||
self.theme = presentationData.theme
|
||||
self.iconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: presentationData.theme.contextMenu.primaryColor)
|
||||
|
||||
self.accessibilityLabel = presentationData.strings.Common_Back
|
||||
}
|
||||
|
||||
self.highlightBackgroundNode.backgroundColor = presentationData.theme.contextMenu.itemHighlightedBackgroundColor
|
||||
@@ -286,23 +294,32 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
var reactionIconNode: ReactionImageNode?
|
||||
let action: () -> Void
|
||||
|
||||
private var item: EngineMessageReactionListContext.Item?
|
||||
|
||||
init(context: AccountContext, availableReactions: AvailableReactions?, action: @escaping () -> Void) {
|
||||
self.action = action
|
||||
self.context = context
|
||||
self.availableReactions = availableReactions
|
||||
|
||||
self.avatarNode = AvatarNode(font: avatarFont)
|
||||
self.avatarNode.isAccessibilityElement = false
|
||||
|
||||
self.highlightBackgroundNode = ASDisplayNode()
|
||||
self.highlightBackgroundNode.isAccessibilityElement = false
|
||||
self.highlightBackgroundNode.alpha = 0.0
|
||||
|
||||
self.titleLabelNode = ImmediateTextNode()
|
||||
self.titleLabelNode.isAccessibilityElement = false
|
||||
self.titleLabelNode.maximumNumberOfLines = 1
|
||||
self.titleLabelNode.isUserInteractionEnabled = false
|
||||
|
||||
self.separatorNode = ASDisplayNode()
|
||||
self.separatorNode.isAccessibilityElement = false
|
||||
|
||||
super.init()
|
||||
|
||||
self.isAccessibilityElement = true
|
||||
|
||||
self.addSubnode(self.separatorNode)
|
||||
self.addSubnode(self.highlightBackgroundNode)
|
||||
self.addSubnode(self.avatarNode)
|
||||
@@ -345,6 +362,12 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
||||
reactionIconNode.removeFromSupernode()
|
||||
}
|
||||
|
||||
if self.item != item {
|
||||
self.item = item
|
||||
|
||||
self.accessibilityLabel = "\(item.peer.debugDisplayTitle) \(item.reaction ?? "")"
|
||||
}
|
||||
|
||||
self.highlightBackgroundNode.backgroundColor = presentationData.theme.contextMenu.itemHighlightedBackgroundColor
|
||||
self.separatorNode.backgroundColor = presentationData.theme.contextMenu.itemSeparatorColor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user