Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions submodules/AccountContext/Sources/ChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 3 additions & 1 deletion submodules/TelegramUI/Sources/ChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,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?
Expand Down Expand Up @@ -6792,11 +6793,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)
}
}

Expand Down