mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various improvements
This commit is contained in:
parent
c92cc87162
commit
d080951f11
@ -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: [],
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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: []
|
||||
)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user