From eb0d2277ac09d865c4905be97d92b1b6411dead1 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sun, 23 Oct 2022 20:53:46 +0400 Subject: [PATCH] Fix pinned message scrolling --- .../Sources/ChatPinnedMessageTitlePanelNode.swift | 2 +- .../TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/submodules/TelegramUI/Sources/ChatPinnedMessageTitlePanelNode.swift b/submodules/TelegramUI/Sources/ChatPinnedMessageTitlePanelNode.swift index 25735f6969..ecb0b7d20c 100644 --- a/submodules/TelegramUI/Sources/ChatPinnedMessageTitlePanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatPinnedMessageTitlePanelNode.swift @@ -290,7 +290,7 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode { } let isReplyThread: Bool - if case .replyThread = interfaceState.chatLocation { + if case let .replyThread(message) = interfaceState.chatLocation, !message.isForumPost { isReplyThread = true } else { isReplyThread = false diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 88296e61c2..5e43274061 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -2298,8 +2298,15 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate items.append(.action(ContextMenuActionItem(text: strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, f in c.dismiss(completion: { if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController { + let targetLocation: NavigateToChatControllerParams.Location + if case let .replyThread(message) = strongSelf.chatLocation { + targetLocation = .replyThread(message) + } else { + targetLocation = .peer(EnginePeer(currentPeer)) + } + let currentPeerId = strongSelf.peerId - strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(EnginePeer(currentPeer)), subject: .message(id: .id(message.id), highlight: true, timecode: nil), keepStack: .always, useExisting: false, purposefulAction: { + strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: targetLocation, subject: .message(id: .id(message.id), highlight: true, timecode: nil), keepStack: .always, useExisting: false, purposefulAction: { var viewControllers = navigationController.viewControllers var indexesToRemove = Set() var keptCurrentChatController = false