Skip to content

Commit e88baee

Browse files
committed
Fix search bar visibility in HashtagSearchControllerNode
1 parent 63a37c5 commit e88baee

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

submodules/AccountContext/Sources/ChatController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,8 @@ public protocol ChatController: ViewController {
10831083
var isSendButtonVisible: Bool { get }
10841084

10851085
var isSelectingMessagesUpdated: ((Bool) -> Void)? { get set }
1086+
var onGalleryPresentationInContextChanged: ((Bool) -> Void)? { get set }
1087+
10861088
func cancelSelectingMessages()
10871089
func activateSearch(domain: ChatSearchDomain, query: String)
10881090
func activateInput(type: ChatControllerActivateInput)

submodules/HashtagSearchUI/Sources/HashtagSearchControllerNode.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,21 @@ final class HashtagSearchControllerNode: ASDisplayNode, ASGestureRecognizerDeleg
192192
}
193193
}
194194

195+
var galleryPresentationCount = 0
196+
let updateSearchBarVisibility: (Bool) -> Void = { [weak self] isPresented in
197+
guard let self else { return }
198+
if isPresented {
199+
galleryPresentationCount += 1
200+
} else {
201+
galleryPresentationCount -= 1
202+
}
203+
let shouldHide = galleryPresentationCount > 0
204+
self.controller?.navigationBar?.setContentNode(shouldHide ? nil : self.searchContentNode, animated: true)
205+
}
206+
self.currentController?.onGalleryPresentationInContextChanged = updateSearchBarVisibility
207+
self.myController?.onGalleryPresentationInContextChanged = updateSearchBarVisibility
208+
self.globalController?.onGalleryPresentationInContextChanged = updateSearchBarVisibility
209+
195210
if controller.mode != .chatOnly {
196211
navigationBar?.setContentNode(self.searchContentNode, animated: false)
197212
}

submodules/TelegramUI/Sources/ChatController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
311311
let temporaryHiddenGalleryMediaDisposable = MetaDisposable()
312312

313313
let galleryPresentationContext = PresentationContext()
314+
public var onGalleryPresentationInContextChanged: ((Bool) -> Void)?
314315

315316
let chatBackgroundNode: WallpaperBackgroundNode
316317
public private(set) var controllerInteraction: ChatControllerInteraction?
@@ -6792,11 +6793,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
67926793
override public func loadDisplayNode() {
67936794
self.loadDisplayNodeImpl()
67946795
self.galleryPresentationContext.view = self.view
6795-
self.galleryPresentationContext.controllersUpdated = { [weak self] _ in
6796+
self.galleryPresentationContext.controllersUpdated = { [weak self] controllers in
67966797
guard let self else {
67976798
return
67986799
}
67996800
self.updateStatusBarPresentation()
6801+
self.onGalleryPresentationInContextChanged?(!controllers.isEmpty)
68006802
}
68016803
}
68026804

0 commit comments

Comments
 (0)