mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-01 01:03:01 +00:00
7f1b6086ae
* 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.
78 lines
3.0 KiB
Swift
78 lines
3.0 KiB
Swift
//
|
|
// Copyright 2025 Element Creations Ltd.
|
|
// Copyright 2024-2025 New Vector Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
enum SecondaryWindowType: Hashable, Codable {
|
|
case room(roomID: String)
|
|
case settings
|
|
}
|
|
|
|
protocol SecureWindowManagerDelegate: AnyObject {
|
|
/// The window manager has configured its windows.
|
|
func windowManagerDidConfigureWindows(_ windowManager: SecureWindowManagerProtocol)
|
|
}
|
|
|
|
protocol SecureWindowManagerProtocol: WindowManagerProtocol {
|
|
var delegate: SecureWindowManagerDelegate? { get set }
|
|
|
|
/// Configures the window manager to operate on the supplied scene.
|
|
func configure(withScene scene: UIWindowScene, session: UISceneSession)
|
|
|
|
func configure(withOpenWindowAction openWindowAction: OpenWindowAction, dismissWindowAction: DismissWindowAction)
|
|
|
|
func handleSceneDisconnection(_ scene: UIWindowScene)
|
|
|
|
func handleRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType)
|
|
|
|
/// Shows the main and overlay window combo, hiding the alternate window.
|
|
func switchToMain()
|
|
|
|
/// Shows the alternate window, hiding the main and overlay combo.
|
|
func switchToAlternate()
|
|
|
|
// MARK: - Secondary window support
|
|
|
|
/// Used by the Application to retrieve the root view for an secondary window
|
|
func windowForType(_ type: SecondaryWindowType) -> AnyView
|
|
}
|
|
|
|
/// A window manager that supports switching between a main app window with an overlay and
|
|
/// an alternate window to switch contexts whilst also preserving the main view hierarchy.
|
|
/// Heavily inspired by https://www.fivestars.blog/articles/swiftui-windows/
|
|
protocol WindowManagerProtocol: AnyObject, OrientationManagerProtocol {
|
|
/// The app's main window (we only support a single scene).
|
|
var mainWindow: UIWindow! { get }
|
|
/// Presented on top of the main window, to display e.g. user indicators.
|
|
var overlayWindow: UIWindow! { get }
|
|
/// A secondary window that can be presented instead of the main/overlay window combo.
|
|
var alternateWindow: UIWindow! { get }
|
|
|
|
/// All the windows being managed
|
|
var windows: [UIWindow] { get }
|
|
|
|
// MARK: - Secondary window support
|
|
|
|
var secondaryWindowsEnabled: Bool { get set }
|
|
|
|
/// Register a coordinator and it's respective flow (if any) within the WindowManager which in turn
|
|
/// invokes the Application's `OpenWindowAction`
|
|
func registerCoordinator(_ coordinator: CoordinatorProtocol,
|
|
flowCoordinator: FlowCoordinatorProtocol?,
|
|
forWindowType type: SecondaryWindowType)
|
|
|
|
/// Closes any window previously opened by registering a coordinator
|
|
func closeAllSecondaryWindows()
|
|
|
|
/// Closes a previously opened window for the given type.
|
|
func closeSecondaryWindow(forType type: SecondaryWindowType)
|
|
}
|
|
|
|
// sourcery: AutoMockable
|
|
extension WindowManagerProtocol { }
|