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(
|
return ChatListItem(
|
||||||
presentationData: chatListPresentationData,
|
presentationData: chatListPresentationData,
|
||||||
context: component.context,
|
context: component.context,
|
||||||
chatListLocation: .savedMessagesChats,
|
chatListLocation: component.peerId == component.context.account.peerId ? .savedMessagesChats : .chatList(groupId: .root),
|
||||||
filterData: nil,
|
filterData: nil,
|
||||||
index: .forum(
|
index: .forum(
|
||||||
pinnedIndex: .none,
|
pinnedIndex: .none,
|
||||||
@ -744,7 +744,7 @@ public final class ChatInlineSearchResultsListComponent: Component {
|
|||||||
inputActivities: nil,
|
inputActivities: nil,
|
||||||
promoInfo: nil,
|
promoInfo: nil,
|
||||||
ignoreUnreadBadge: false,
|
ignoreUnreadBadge: false,
|
||||||
displayAsMessage: false,
|
displayAsMessage: component.peerId != component.context.account.peerId,
|
||||||
hasFailedMessages: false,
|
hasFailedMessages: false,
|
||||||
forumTopicData: nil,
|
forumTopicData: nil,
|
||||||
topForumTopicItems: [],
|
topForumTopicItems: [],
|
||||||
|
@ -398,7 +398,23 @@ func updateChatPresentationInterfaceStateImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if updatedChatPresentationInterfaceState.displayHistoryFilterAsList {
|
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)
|
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) {
|
if let peer = peerViewMainPeer(view) as? TelegramChannel, !peer.hasPermission(.sendSomething) {
|
||||||
return .single(false)
|
return .single(false)
|
||||||
} else {
|
} else {
|
||||||
return context.account.viewTracker.scheduledMessagesViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder))
|
if case let .replyThread(message) = chatLocation, message.peerId == context.account.peerId {
|
||||||
|> map { view, _, _ in
|
return context.account.viewTracker.scheduledMessagesViewForLocation(context.chatLocationInput(for: .peer(id: context.account.peerId), contextHolder: Atomic(value: nil)))
|
||||||
return !view.entries.isEmpty
|
|> 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
|
return renderedPeer
|
||||||
}.updatedSavedMessagesTopicPeer(savedMessagesPeer?.peer)
|
}.updatedSavedMessagesTopicPeer(savedMessagesPeer?.peer)
|
||||||
.updatedHasSearchTags(hasSearchTags)
|
.updatedHasSearchTags(hasSearchTags)
|
||||||
|
.updatedHasScheduledMessages(hasScheduledMessages)
|
||||||
})
|
})
|
||||||
|
|
||||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.setPeer(context: strongSelf.context, theme: strongSelf.presentationData.theme, peer: savedMessagesPeer?.peer, overrideImage: imageOverride)
|
(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 {
|
guard let navigationController = self.effectiveNavigationController, navigationController.topViewController == self else {
|
||||||
return
|
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
|
controller.navigationPresentation = .modal
|
||||||
navigationController.pushViewController(controller)
|
navigationController.pushViewController(controller)
|
||||||
}
|
}
|
||||||
|
@ -2453,6 +2453,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
if self.alwaysShowSearchResultsAsList {
|
if self.alwaysShowSearchResultsAsList {
|
||||||
displayInlineSearch = true
|
displayInlineSearch = true
|
||||||
}
|
}
|
||||||
|
if case .peer(self.context.account.peerId) = self.chatPresentationInterfaceState.chatLocation {
|
||||||
|
displayInlineSearch = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let peerId = self.chatPresentationInterfaceState.chatLocation.peerId, displayInlineSearch {
|
if let peerId = self.chatPresentationInterfaceState.chatLocation.peerId, displayInlineSearch {
|
||||||
@ -2473,6 +2476,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
mappedContents = .tag(historyFilter.customTag)
|
mappedContents = .tag(historyFilter.customTag)
|
||||||
} else if let search = self.chatPresentationInterfaceState.search, self.alwaysShowSearchResultsAsList {
|
} else if let search = self.chatPresentationInterfaceState.search, self.alwaysShowSearchResultsAsList {
|
||||||
mappedContents = .search(query: search.query, includeSavedPeers: 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 {
|
} else {
|
||||||
mappedContents = .empty
|
mappedContents = .empty
|
||||||
}
|
}
|
||||||
@ -2566,7 +2571,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
chatLocationContextHolder: Atomic(value: nil),
|
chatLocationContextHolder: Atomic(value: nil),
|
||||||
scheduled: false,
|
scheduled: false,
|
||||||
fixedCombinedReadStates: nil,
|
fixedCombinedReadStates: nil,
|
||||||
tag: .customTag(tag),
|
tag: tag.length == 0 ? nil : .customTag(tag),
|
||||||
appendMessagesFromTheSameGroup: false,
|
appendMessagesFromTheSameGroup: false,
|
||||||
additionalData: []
|
additionalData: []
|
||||||
)
|
)
|
||||||
|
@ -187,8 +187,10 @@ func secondaryRightNavigationButtonForChatInterfaceState(context: AccountContext
|
|||||||
if presentationInterfaceState.interfaceState.selectionState != nil {
|
if presentationInterfaceState.interfaceState.selectionState != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if case .peer(context.account.peerId) = presentationInterfaceState.chatLocation {
|
if case .standard(.default) = presentationInterfaceState.mode {
|
||||||
return moreInfoNavigationButton
|
if case .peer(context.account.peerId) = presentationInterfaceState.chatLocation, presentationInterfaceState.subject != .scheduledMessages {
|
||||||
|
return moreInfoNavigationButton
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -191,6 +191,8 @@ final class ChatTagSearchInputPanelNode: ChatInputPanelNode {
|
|||||||
//TODO:localize
|
//TODO:localize
|
||||||
resultsTextString.append(AnimatedTextComponent.Item(id: AnyHashable("count_n"), content: .number(count, minDigits: 1)))
|
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")))
|
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
|
let height: CGFloat
|
||||||
|
Loading…
x
Reference in New Issue
Block a user