Fix reactions

This commit is contained in:
Ali 2021-11-19 19:50:04 +04:00
parent 41fbe0ef76
commit 7f142f0619
14 changed files with 14 additions and 62 deletions

View File

@ -210,7 +210,7 @@ public class BoxedMessage: NSObject {
public class Serialization: NSObject, MTSerialization {
public func currentLayer() -> UInt {
return 135
return 140
}
public func parseMessage(_ data: Data!) -> Any! {

View File

@ -865,7 +865,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
var edited = false
var viewCount: Int? = nil
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let _ = attribute as? EditedMessageAttribute, isEmoji {
edited = true
@ -875,10 +875,6 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -322,7 +322,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
}
var viewCount: Int?
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: message.attributes)?.reactions ?? []
for attribute in message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
edited = !attribute.isHidden
@ -332,10 +332,6 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -1470,7 +1470,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
}
var viewCount: Int?
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: message.attributes)?.reactions ?? []
for attribute in message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
edited = !attribute.isHidden
@ -1480,10 +1480,6 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -154,7 +154,7 @@ class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
}
var viewCount: Int?
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
edited = !attribute.isHidden
@ -164,10 +164,6 @@ class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -787,7 +787,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
}
}
node.frame = CGRect(origin: CGPoint(x: reactionOffset + 1.0, y: backgroundInsets.top + 1.0 + offset), size: layout.size)
reactionOffset += 1.0 + layout.size.width
reactionOffset += 1.0 + layout.size.width + 4.0
} else if let reactionCountNode = strongSelf.reactionCountNode {
strongSelf.reactionCountNode = nil
if animated {

View File

@ -305,7 +305,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
}
var viewCount: Int?
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: message.attributes)?.reactions ?? []
for attribute in message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
edited = !attribute.isHidden
@ -315,10 +315,6 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}
if forcedIsEdited {

View File

@ -262,7 +262,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
let sentViaBot = false
var viewCount: Int? = nil
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
edited = !attribute.isHidden
@ -272,10 +272,6 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -183,7 +183,7 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
}
var viewCount: Int?
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
edited = !attribute.isHidden
@ -193,10 +193,6 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -152,7 +152,7 @@ class ChatMessageMediaBubbleContentNode: ChatMessageBubbleContentNode {
}
var viewCount: Int?
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
if case .mosaic = preparePosition {
@ -165,10 +165,6 @@ class ChatMessageMediaBubbleContentNode: ChatMessageBubbleContentNode {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -1024,7 +1024,7 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
}
var viewCount: Int?
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
edited = !attribute.isHidden
@ -1034,10 +1034,6 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -53,7 +53,7 @@ class ChatMessageRestrictedBubbleContentNode: ChatMessageBubbleContentNode {
var viewCount: Int?
var rawText = ""
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
edited = !attribute.isHidden
@ -65,10 +65,6 @@ class ChatMessageRestrictedBubbleContentNode: ChatMessageBubbleContentNode {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -459,7 +459,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
var edited = false
var viewCount: Int? = nil
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let _ = attribute as? EditedMessageAttribute, isEmoji {
edited = true
@ -469,10 +469,6 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}

View File

@ -107,7 +107,7 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
}
var viewCount: Int?
var dateReplies = 0
var dateReactions: [MessageReaction] = []
let dateReactions: [MessageReaction] = mergedMessageReactions(attributes: item.message.attributes)?.reactions ?? []
for attribute in item.message.attributes {
if let attribute = attribute as? EditedMessageAttribute {
@ -118,10 +118,6 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
if let channel = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .group = channel.info {
dateReplies = Int(attribute.count)
}
} else if let attribute = attribute as? PendingReactionsMessageAttribute {
if let value = attribute.value {
dateReactions = [MessageReaction(value: value, count: 1, isSelected: true)]
}
}
}