Show a toast and don't highlight bubbles randomly when navigating to a deleted message via link

This commit is contained in:
Ilya Laktyushin 2021-06-17 04:58:59 +03:00
parent cd75f7e364
commit bb28e0e4d3
2 changed files with 12 additions and 4 deletions

View File

@ -4526,9 +4526,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
strongSelf.chatDisplayNode.updatePlainInputSeparatorAlpha(plainInputSeparatorAlpha, transition: .animated(duration: 0.2, curve: .easeInOut))
}
self.chatDisplayNode.historyNode.scrolledToIndex = { [weak self] toIndex in
self.chatDisplayNode.historyNode.scrolledToIndex = { [weak self] toIndex, initial in
if let strongSelf = self, case let .message(index) = toIndex {
if let controllerInteraction = strongSelf.controllerInteraction {
if case let .message(messageId, _) = strongSelf.subject, initial, messageId != index.id {
strongSelf.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .info(text: strongSelf.presentationData.strings.Conversation_MessageDoesntExist), elevatedLayout: false, action: { _ in return true }), in: .current)
} else if let controllerInteraction = strongSelf.controllerInteraction {
if let message = strongSelf.chatDisplayNode.historyNode.messageInCurrentHistoryView(index.id) {
let highlightedState = ChatInterfaceHighlightedState(messageStableId: message.stableId)
controllerInteraction.highlightedState = highlightedState

View File

@ -545,7 +545,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
private var maxVisibleMessageIndexReported: MessageIndex?
var maxVisibleMessageIndexUpdated: ((MessageIndex) -> Void)?
var scrolledToIndex: ((MessageHistoryAnchorIndex) -> Void)?
var scrolledToIndex: ((MessageHistoryAnchorIndex, Bool) -> Void)?
var scrolledToSomeIndex: (() -> Void)?
var beganDragging: (() -> Void)?
@ -1887,7 +1887,13 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
if let scrolledToIndex = transition.scrolledToIndex {
if let strongSelf = self {
strongSelf.scrolledToIndex?(scrolledToIndex)
let isInitial: Bool
if case .Initial = transition.reason {
isInitial = true
} else {
isInitial = false
}
strongSelf.scrolledToIndex?(scrolledToIndex, isInitial)
}
} else if transition.scrolledToSomeIndex {
self?.scrolledToSomeIndex?()