From 8a2bcabfefd89a5fe6213175900fe8a702f430ee Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Thu, 21 Mar 2024 21:11:10 +0400 Subject: [PATCH] Fix emoji status selection in chatlist --- .../ChatListUI/Sources/ChatListController.swift | 2 +- .../Sources/ChatListHeaderComponent.swift | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index a5eb6d69ee..2786f064f7 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -844,7 +844,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController var selectedItems = Set() var topStatusTitle = self.presentationData.strings.PeerStatusSetup_NoTimerTitle var currentSelection: Int64? - if let peerStatus = self.findTitleView()?.title.peerStatus, case let .emoji(emojiStatus) = peerStatus { + if let emojiStatus = self.chatListHeaderView()?.emojiStatus() { selectedItems.insert(MediaId(namespace: Namespaces.Media.CloudFile, id: emojiStatus.fileId)) currentSelection = emojiStatus.fileId diff --git a/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListHeaderComponent.swift b/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListHeaderComponent.swift index ae0f24162d..c030552d5e 100644 --- a/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListHeaderComponent.swift +++ b/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListHeaderComponent.swift @@ -1090,6 +1090,18 @@ public final class ChatListHeaderComponent: Component { public func findTitleView() -> ChatListTitleView? { return self.primaryContentView?.chatListTitleView } + + public func emojiStatus() -> PeerEmojiStatus? { + guard let component = self.component else { + return nil + } + if let _ = component.storySubscriptions, let primaryContent = component.primaryContent, let chatListTitle = primaryContent.chatListTitle, let peerStatus = chatListTitle.peerStatus, case let .emoji(emojiStatus) = peerStatus { + return emojiStatus + } else if let peerStatus = self.findTitleView()?.title.peerStatus, case let .emoji(emojiStatus) = peerStatus { + return emojiStatus + } + return nil + } } public func makeView() -> View {