diff --git a/submodules/TelegramUI/Components/Chat/ChatInlineSearchResultsListComponent/Sources/ChatInlineSearchResultsListComponent.swift b/submodules/TelegramUI/Components/Chat/ChatInlineSearchResultsListComponent/Sources/ChatInlineSearchResultsListComponent.swift index 0778594c37..81272ab15b 100644 --- a/submodules/TelegramUI/Components/Chat/ChatInlineSearchResultsListComponent/Sources/ChatInlineSearchResultsListComponent.swift +++ b/submodules/TelegramUI/Components/Chat/ChatInlineSearchResultsListComponent/Sources/ChatInlineSearchResultsListComponent.swift @@ -722,7 +722,7 @@ public final class ChatInlineSearchResultsListComponent: Component { return ChatListItem( presentationData: chatListPresentationData, context: component.context, - chatListLocation: .savedMessagesChats, + chatListLocation: component.peerId == component.context.account.peerId ? .savedMessagesChats : .chatList(groupId: .root), filterData: nil, index: .forum( pinnedIndex: .none, @@ -744,7 +744,7 @@ public final class ChatInlineSearchResultsListComponent: Component { inputActivities: nil, promoInfo: nil, ignoreUnreadBadge: false, - displayAsMessage: false, + displayAsMessage: component.peerId != component.context.account.peerId, hasFailedMessages: false, forumTopicData: nil, topForumTopicItems: [], diff --git a/submodules/TelegramUI/Sources/Chat/UpdateChatPresentationInterfaceState.swift b/submodules/TelegramUI/Sources/Chat/UpdateChatPresentationInterfaceState.swift index 4ae3d58e7e..0568435047 100644 --- a/submodules/TelegramUI/Sources/Chat/UpdateChatPresentationInterfaceState.swift +++ b/submodules/TelegramUI/Sources/Chat/UpdateChatPresentationInterfaceState.swift @@ -398,7 +398,23 @@ func updateChatPresentationInterfaceStateImpl( } if updatedChatPresentationInterfaceState.displayHistoryFilterAsList { - if updatedChatPresentationInterfaceState.search?.resultsState == nil && updatedChatPresentationInterfaceState.historyFilter == nil && !selfController.alwaysShowSearchResultsAsList { + var canDisplayAsList = false + if updatedChatPresentationInterfaceState.search != nil { + if updatedChatPresentationInterfaceState.search?.resultsState != nil { + canDisplayAsList = true + } + if updatedChatPresentationInterfaceState.historyFilter != nil { + canDisplayAsList = true + } + if selfController.alwaysShowSearchResultsAsList { + canDisplayAsList = true + } + if case .peer(selfController.context.account.peerId) = updatedChatPresentationInterfaceState.chatLocation { + canDisplayAsList = true + } + } + + if !canDisplayAsList { updatedChatPresentationInterfaceState = updatedChatPresentationInterfaceState.updatedDisplayHistoryFilterAsList(false) } } diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index efdbe55198..78b3dda4c8 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -5664,9 +5664,18 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if let peer = peerViewMainPeer(view) as? TelegramChannel, !peer.hasPermission(.sendSomething) { return .single(false) } else { - return context.account.viewTracker.scheduledMessagesViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder)) - |> map { view, _, _ in - return !view.entries.isEmpty + if case let .replyThread(message) = chatLocation, message.peerId == context.account.peerId { + return context.account.viewTracker.scheduledMessagesViewForLocation(context.chatLocationInput(for: .peer(id: context.account.peerId), contextHolder: Atomic(value: nil))) + |> map { view, _, _ in + return !view.entries.isEmpty + } + |> distinctUntilChanged + } else { + return context.account.viewTracker.scheduledMessagesViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder)) + |> map { view, _, _ in + return !view.entries.isEmpty + } + |> distinctUntilChanged } } } @@ -5815,6 +5824,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G return renderedPeer }.updatedSavedMessagesTopicPeer(savedMessagesPeer?.peer) .updatedHasSearchTags(hasSearchTags) + .updatedHasScheduledMessages(hasScheduledMessages) }) (strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.setPeer(context: strongSelf.context, theme: strongSelf.presentationData.theme, peer: savedMessagesPeer?.peer, overrideImage: imageOverride) @@ -17287,7 +17297,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G guard let navigationController = self.effectiveNavigationController, navigationController.topViewController == self else { return } - let controller = ChatControllerImpl(context: self.context, chatLocation: self.chatLocation, subject: .scheduledMessages) + + var mappedChatLocation = self.chatLocation + if case let .replyThread(message) = self.chatLocation, message.peerId == self.context.account.peerId { + mappedChatLocation = .peer(id: self.context.account.peerId) + } + + let controller = ChatControllerImpl(context: self.context, chatLocation: mappedChatLocation, subject: .scheduledMessages) controller.navigationPresentation = .modal navigationController.pushViewController(controller) } diff --git a/submodules/TelegramUI/Sources/ChatControllerNode.swift b/submodules/TelegramUI/Sources/ChatControllerNode.swift index d42c19fc13..552294d9a5 100644 --- a/submodules/TelegramUI/Sources/ChatControllerNode.swift +++ b/submodules/TelegramUI/Sources/ChatControllerNode.swift @@ -2453,6 +2453,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { if self.alwaysShowSearchResultsAsList { displayInlineSearch = true } + if case .peer(self.context.account.peerId) = self.chatPresentationInterfaceState.chatLocation { + displayInlineSearch = true + } } if let peerId = self.chatPresentationInterfaceState.chatLocation.peerId, displayInlineSearch { @@ -2473,6 +2476,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { mappedContents = .tag(historyFilter.customTag) } else if let search = self.chatPresentationInterfaceState.search, self.alwaysShowSearchResultsAsList { mappedContents = .search(query: search.query, includeSavedPeers: self.alwaysShowSearchResultsAsList) + } else if case .peer(self.context.account.peerId) = self.chatPresentationInterfaceState.chatLocation { + mappedContents = .tag(MemoryBuffer()) } else { mappedContents = .empty } @@ -2566,7 +2571,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { chatLocationContextHolder: Atomic(value: nil), scheduled: false, fixedCombinedReadStates: nil, - tag: .customTag(tag), + tag: tag.length == 0 ? nil : .customTag(tag), appendMessagesFromTheSameGroup: false, additionalData: [] ) diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateNavigationButtons.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateNavigationButtons.swift index f07cc50c99..6526861686 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateNavigationButtons.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateNavigationButtons.swift @@ -187,8 +187,10 @@ func secondaryRightNavigationButtonForChatInterfaceState(context: AccountContext if presentationInterfaceState.interfaceState.selectionState != nil { return nil } - if case .peer(context.account.peerId) = presentationInterfaceState.chatLocation { - return moreInfoNavigationButton + if case .standard(.default) = presentationInterfaceState.mode { + if case .peer(context.account.peerId) = presentationInterfaceState.chatLocation, presentationInterfaceState.subject != .scheduledMessages { + return moreInfoNavigationButton + } } return nil diff --git a/submodules/TelegramUI/Sources/ChatTagSearchInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatTagSearchInputPanelNode.swift index e5f3a12f27..db5571e274 100644 --- a/submodules/TelegramUI/Sources/ChatTagSearchInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatTagSearchInputPanelNode.swift @@ -191,6 +191,8 @@ final class ChatTagSearchInputPanelNode: ChatInputPanelNode { //TODO:localize resultsTextString.append(AnimatedTextComponent.Item(id: AnyHashable("count_n"), content: .number(count, minDigits: 1))) resultsTextString.append(AnimatedTextComponent.Item(id: AnyHashable("count_message"), isUnbreakable: true, content: .text(count == 1 ? " message" : " messages"))) + } else if let context = self.context, case .peer(context.account.peerId) = params.interfaceState.chatLocation { + canChangeListMode = true } let height: CGFloat