mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Introduce support for multiple windows on mac and iPad OS
Once the app starts the WindowManager is configured with SwiftUI's environment OpenWindowAction. It can then be used to register coordinators (that provide the toPresentable view) and an optional flow coordinator (as most of the screens are part of a flow, especially rooms). Once a coordinator is registed, the WindowManager invokes the OpenWindowAction which in turn makes the Application call its newly introduced WindowManagerWindowType WindowGroup's block to instantiate a new visual window rooting that view. The WindowManager is also responsible for wrapping the presentable in a disappearance block and clean up the coordinator stack. # Conflicts: # ElementX/Sources/Application/AppCoordinator.swift
This commit is contained in:
committed by
Stefan Ceriu
parent
91a10f4d51
commit
f1ef968975
@@ -8,6 +8,11 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum WindowManagerWindowType: Hashable, Codable {
|
||||
case room(roomID: String)
|
||||
case settings
|
||||
}
|
||||
|
||||
protocol SecureWindowManagerDelegate: AnyObject {
|
||||
/// The window manager has configured its windows.
|
||||
func windowManagerDidConfigureWindows(_ windowManager: SecureWindowManagerProtocol)
|
||||
@@ -20,6 +25,12 @@ protocol SecureWindowManagerProtocol: WindowManagerProtocol {
|
||||
/// Configures the window manager to operate on the supplied scene.
|
||||
func configure(with windowScene: UIWindowScene)
|
||||
|
||||
func configure(with openWindowAction: OpenWindowAction)
|
||||
|
||||
func handleRoute(_ appRoute: AppRoute, windowType: WindowManagerWindowType)
|
||||
|
||||
func windowForType(_ type: WindowManagerWindowType) -> AnyView?
|
||||
|
||||
/// Shows the main and overlay window combo, hiding the alternate window.
|
||||
func switchToMain()
|
||||
|
||||
@@ -43,6 +54,8 @@ protocol WindowManagerProtocol: AnyObject, OrientationManagerProtocol {
|
||||
/// All the windows being managed
|
||||
var windows: [UIWindow] { get }
|
||||
|
||||
func registerCoordinator(_ coordinator: CoordinatorProtocol, flowCoordinator: FlowCoordinatorProtocol?, forWindowType type: WindowManagerWindowType)
|
||||
|
||||
/// Makes the global search window key. Used to get automatic text field focus.
|
||||
func showGlobalSearch()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user