This commit is contained in:
rootkitt3n 2026-06-10 05:10:05 +08:00 committed by GitHub
commit a02fd25c48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 1 deletions

View file

@ -1129,6 +1129,8 @@ public protocol ChatController: ViewController {
var isSendButtonVisible: Bool { get }
var isSelectingMessagesUpdated: ((Bool) -> Void)? { get set }
var onGalleryPresentationInContextChanged: ((Bool) -> Void)? { get set }
func cancelSelectingMessages()
func activateSearch(domain: ChatSearchDomain, query: String)
func activateInput(type: ChatControllerActivateInput)

View file

@ -192,6 +192,21 @@ final class HashtagSearchControllerNode: ASDisplayNode, ASGestureRecognizerDeleg
}
}
var galleryPresentationCount = 0
let updateSearchBarVisibility: (Bool) -> Void = { [weak self] isPresented in
guard let self else { return }
if isPresented {
galleryPresentationCount += 1
} else {
galleryPresentationCount -= 1
}
let shouldHide = galleryPresentationCount > 0
self.controller?.navigationBar?.setContentNode(shouldHide ? nil : self.searchContentNode, animated: true)
}
self.currentController?.onGalleryPresentationInContextChanged = updateSearchBarVisibility
self.myController?.onGalleryPresentationInContextChanged = updateSearchBarVisibility
self.globalController?.onGalleryPresentationInContextChanged = updateSearchBarVisibility
if controller.mode != .chatOnly {
navigationBar?.setContentNode(self.searchContentNode, animated: false)
}

View file

@ -310,6 +310,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
let temporaryHiddenGalleryMediaDisposable = MetaDisposable()
let galleryPresentationContext = PresentationContext()
public var onGalleryPresentationInContextChanged: ((Bool) -> Void)?
let chatBackgroundNode: WallpaperBackgroundNode
public private(set) var controllerInteraction: ChatControllerInteraction?
@ -7376,11 +7377,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
override public func loadDisplayNode() {
self.loadDisplayNodeImpl()
self.galleryPresentationContext.view = self.view
self.galleryPresentationContext.controllersUpdated = { [weak self] _ in
self.galleryPresentationContext.controllersUpdated = { [weak self] controllers in
guard let self else {
return
}
self.updateStatusBarPresentation()
self.onGalleryPresentationInContextChanged?(!controllers.isEmpty)
}
}