Search tab (#5754)

* Add a developer flag for the search tab
Introduces a globalSearchEnabled user preference (off by default) with a toggle in Developer Options, used to gate the new search experience.

* Support search role tabs in the tab coordinator
Migrates the NavigationTabCoordinator to SwiftUI's value-based Tab API and adds an isSearch option so a tab can adopt the iOS 26 .search role, which detaches it into the trailing search button in the tab bar.

* Moves room search to a new screen
Adds a new screen that filters the alternate room summary provider as you type, shows an empty state, and lists matching rooms with their matrix identifier. Supports hardware keyboard selection (arrow keys to move through results, return to open) by reaching into the system search field.

* Present search in a dedicated tab
Adds the search tab to the chats flow on iOS 26 when the flag is enabled, rendered as the detached .search role button. The Cmd+K shortcut now selects this tab, and the home screen's inline search is hidden while the tab is available.

* Remove the old global search screen
The dedicated search tab replaces the Cmd+K floating window, so the GlobalSearchScreen, its window plumbing in the WindowManager, and its presentation in the chats flow are all removed.
This commit is contained in:
Stefan Ceriu
2026-06-19 13:50:17 +03:00
committed by GitHub
parent 9a6f7595e5
commit 7f1b6086ae
58 changed files with 731 additions and 780 deletions
@@ -17,7 +17,6 @@ class WindowManager: SecureWindowManagerProtocol {
private(set) var mainWindow: UIWindow!
private(set) var overlayWindow: UIWindow!
private(set) var globalSearchWindow: UIWindow!
private(set) var alternateWindow: UIWindow!
private(set) var openWindowAction: OpenWindowAction!
@@ -32,7 +31,7 @@ class WindowManager: SecureWindowManagerProtocol {
}
var windows: [UIWindow] {
[mainWindow, overlayWindow, globalSearchWindow, alternateWindow]
[mainWindow, overlayWindow, alternateWindow]
}
// periphery:ignore - auto cancels when reassigned
@@ -80,11 +79,6 @@ class WindowManager: SecureWindowManagerProtocol {
overlayWindow.backgroundColor = .clear
overlayWindow.isHidden = false
globalSearchWindow = UIWindow(windowScene: scene)
globalSearchWindow.tintColor = .compound.textActionPrimary
globalSearchWindow.backgroundColor = .clear
globalSearchWindow.isHidden = true
alternateWindow = UIWindow(windowScene: scene)
alternateWindow.tintColor = .compound.textActionPrimary
@@ -138,8 +132,6 @@ class WindowManager: SecureWindowManagerProtocol {
// e.g. the keyboard being displayed on top of a call sheet.
mainWindow.endEditing(true)
hideGlobalSearch()
// alternateWindow.isHidden = false cannot got inside the Task otherwise the timing
// is poor when you lock the phone - you briefly see the main window for a few
// frames after you've unlocked the phone and then the placeholder animates in.
@@ -149,41 +141,9 @@ class WindowManager: SecureWindowManagerProtocol {
mainWindow.isHidden = true
overlayWindow.isHidden = true
globalSearchWindow.isHidden = true
}
}
func showGlobalSearch() {
MXLog.info("Received global search presentation request.")
guard alternateWindow.isHidden else {
MXLog.info("The alternate window is visible, ignoring.")
return
}
if let mainSession {
let request = UISceneSessionActivationRequest(session: mainSession)
UIApplication.shared.activateSceneSession(for: request) { error in
MXLog.error("Failed to focus window with error: \(error)")
}
}
globalSearchWindow.isHidden = false
globalSearchWindow.makeKeyAndVisible()
}
func hideGlobalSearch() {
MXLog.info("Received global search dismissal request.")
guard alternateWindow.isHidden else {
MXLog.info("The alternate window is visible, ignoring.")
return
}
globalSearchWindow.isHidden = true
mainWindow.makeKey()
}
// MARK: - OrientationManager
func setOrientation(_ orientation: UIInterfaceOrientationMask) {