mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Custom dismiss for inline chat search
This commit is contained in:
parent
47660fcf2b
commit
561c4287b5
@ -938,6 +938,7 @@ public protocol ChatController: ViewController {
|
|||||||
var purposefulAction: (() -> Void)? { get set }
|
var purposefulAction: (() -> Void)? { get set }
|
||||||
|
|
||||||
var stateUpdated: ((ContainedViewLayoutTransition) -> Void)? { get set }
|
var stateUpdated: ((ContainedViewLayoutTransition) -> Void)? { get set }
|
||||||
|
var customDismissSearch: (() -> Void)? { get set }
|
||||||
|
|
||||||
var selectedMessageIds: Set<EngineMessage.Id>? { get }
|
var selectedMessageIds: Set<EngineMessage.Id>? { get }
|
||||||
var presentationInterfaceStateSignal: Signal<Any, NoError> { get }
|
var presentationInterfaceStateSignal: Signal<Any, NoError> { get }
|
||||||
|
@ -409,6 +409,17 @@ public final class PeerInfoChatListPaneNode: ASDisplayNode, PeerInfoPaneNode, UI
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chatController.customDismissSearch = { [weak self] in
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if self.searchNavigationContentNode !== nil {
|
||||||
|
self.searchNavigationContentNode = nil
|
||||||
|
self.externalDataUpdated?(.animated(duration: 0.4, curve: .spring))
|
||||||
|
}
|
||||||
|
|
||||||
|
self.removeChatController()
|
||||||
|
}
|
||||||
chatController.stateUpdated = { [weak self] transition in
|
chatController.stateUpdated = { [weak self] transition in
|
||||||
guard let self, let chatController = self.chatController else {
|
guard let self, let chatController = self.chatController else {
|
||||||
return
|
return
|
||||||
|
@ -517,6 +517,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
public var customNavigationPanelNode: ChatControllerCustomNavigationPanelNode?
|
public var customNavigationPanelNode: ChatControllerCustomNavigationPanelNode?
|
||||||
public var stateUpdated: ((ContainedViewLayoutTransition) -> Void)?
|
public var stateUpdated: ((ContainedViewLayoutTransition) -> Void)?
|
||||||
|
|
||||||
|
public var customDismissSearch: (() -> Void)?
|
||||||
|
|
||||||
public override var customData: Any? {
|
public override var customData: Any? {
|
||||||
return self.chatLocation
|
return self.chatLocation
|
||||||
}
|
}
|
||||||
@ -9091,13 +9093,20 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
strongSelf.updateItemNodesSearchTextHighlightStates()
|
strongSelf.updateItemNodesSearchTextHighlightStates()
|
||||||
})
|
})
|
||||||
}, dismissMessageSearch: { [weak self] in
|
}, dismissMessageSearch: { [weak self] in
|
||||||
if let strongSelf = self {
|
guard let self else {
|
||||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { current in
|
return
|
||||||
return current.updatedSearch(nil).updatedHistoryFilter(nil)
|
|
||||||
})
|
|
||||||
strongSelf.updateItemNodesSearchTextHighlightStates()
|
|
||||||
strongSelf.searchResultsController = nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let customDismissSearch = self.customDismissSearch {
|
||||||
|
customDismissSearch()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.updateChatPresentationInterfaceState(animated: true, interactive: true, { current in
|
||||||
|
return current.updatedSearch(nil).updatedHistoryFilter(nil)
|
||||||
|
})
|
||||||
|
self.updateItemNodesSearchTextHighlightStates()
|
||||||
|
self.searchResultsController = nil
|
||||||
}, updateMessageSearch: { [weak self] query in
|
}, updateMessageSearch: { [weak self] query in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { current in
|
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { current in
|
||||||
|
@ -2475,8 +2475,12 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
mappedContents = .search(query: self.chatPresentationInterfaceState.search?.query ?? "", includeSavedPeers: self.alwaysShowSearchResultsAsList)
|
mappedContents = .search(query: self.chatPresentationInterfaceState.search?.query ?? "", includeSavedPeers: self.alwaysShowSearchResultsAsList)
|
||||||
} else if let historyFilter = self.chatPresentationInterfaceState.historyFilter {
|
} else if let historyFilter = self.chatPresentationInterfaceState.historyFilter {
|
||||||
mappedContents = .tag(historyFilter.customTag)
|
mappedContents = .tag(historyFilter.customTag)
|
||||||
} else if let search = self.chatPresentationInterfaceState.search, !search.query.isEmpty, self.alwaysShowSearchResultsAsList {
|
} else if let search = self.chatPresentationInterfaceState.search, self.alwaysShowSearchResultsAsList {
|
||||||
mappedContents = .search(query: search.query, includeSavedPeers: self.alwaysShowSearchResultsAsList)
|
if !search.query.isEmpty {
|
||||||
|
mappedContents = .search(query: search.query, includeSavedPeers: self.alwaysShowSearchResultsAsList)
|
||||||
|
} else {
|
||||||
|
mappedContents = .empty
|
||||||
|
}
|
||||||
} else if case .peer(self.context.account.peerId) = self.chatPresentationInterfaceState.chatLocation {
|
} else if case .peer(self.context.account.peerId) = self.chatPresentationInterfaceState.chatLocation {
|
||||||
mappedContents = .tag(MemoryBuffer())
|
mappedContents = .tag(MemoryBuffer())
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user