Fix quote navigation

This commit is contained in:
Isaac 2024-01-15 16:12:56 +04:00
parent 3be816e615
commit 7ca15b18d4

View File

@ -4161,6 +4161,8 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
for attribute in item.message.attributes { for attribute in item.message.attributes {
if let attribute = attribute as? ReplyMessageAttribute { if let attribute = attribute as? ReplyMessageAttribute {
if let threadId = item.message.threadId, Int32(clamping: threadId) == attribute.messageId.id, let quotedReply = item.message.attributes.first(where: { $0 is QuotedReplyMessageAttribute }) as? QuotedReplyMessageAttribute { if let threadId = item.message.threadId, Int32(clamping: threadId) == attribute.messageId.id, let quotedReply = item.message.attributes.first(where: { $0 is QuotedReplyMessageAttribute }) as? QuotedReplyMessageAttribute {
let _ = quotedReply
return .action(InternalBubbleTapAction.Action({ [weak self, weak replyInfoNode] in return .action(InternalBubbleTapAction.Action({ [weak self, weak replyInfoNode] in
guard let self, let item = self.item, let replyInfoNode else { guard let self, let item = self.item, let replyInfoNode else {
return return
@ -4170,7 +4172,11 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
item.controllerInteraction.requestMessageUpdate(item.message.id, false) item.controllerInteraction.requestMessageUpdate(item.message.id, false)
return return
} }
item.controllerInteraction.attemptedNavigationToPrivateQuote(quotedReply.peerId.flatMap { item.message.peers[$0] }) var progress: Promise<Bool>?
if let replyInfoNode = self.replyInfoNode {
progress = replyInfoNode.makeProgress()
}
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId, NavigateToMessageParams(timestamp: nil, quote: attribute.isQuote ? attribute.quote.flatMap { quote in NavigateToMessageParams.Quote(string: quote.text, offset: quote.offset) } : nil, progress: progress))
}, contextMenuOnLongPress: true)) }, contextMenuOnLongPress: true))
} }