diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 578c98f75d..153908f236 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -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 diff --git a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift index a49f97206c..2954278e19 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift @@ -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?()