mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Cleanup following the AppMediator introduction (#2723)
- stop using multiple background task, the appCoordinator sync one is enough for the whole app - move the AppMeditor to the MainActor - expose the WindowManager through the AppMediator - hide sensitive WindowManager API behind a different protocol - remove the now unnecessary `BackgroundTaskService`
This commit is contained in:
@@ -16,18 +16,29 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
protocol WindowManagerDelegate: AnyObject {
|
||||
protocol SecureWindowManagerDelegate: AnyObject {
|
||||
/// The window manager has configured its windows.
|
||||
func windowManagerDidConfigureWindows(_ windowManager: WindowManagerProtocol)
|
||||
func windowManagerDidConfigureWindows(_ windowManager: SecureWindowManagerProtocol)
|
||||
}
|
||||
|
||||
@MainActor
|
||||
protocol SecureWindowManagerProtocol: WindowManagerProtocol {
|
||||
var delegate: SecureWindowManagerDelegate? { get set }
|
||||
|
||||
/// Configures the window manager to operate on the supplied scene.
|
||||
func configure(with windowScene: UIWindowScene)
|
||||
|
||||
/// 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()
|
||||
}
|
||||
|
||||
/// 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 {
|
||||
var delegate: WindowManagerDelegate? { get set }
|
||||
|
||||
/// 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.
|
||||
@@ -40,15 +51,6 @@ protocol WindowManagerProtocol: AnyObject, OrientationManagerProtocol {
|
||||
/// All the windows being managed
|
||||
var windows: [UIWindow] { get }
|
||||
|
||||
/// Configures the window manager to operate on the supplied scene.
|
||||
func configure(with windowScene: UIWindowScene)
|
||||
|
||||
/// 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()
|
||||
|
||||
/// Makes the global search window key. Used to get automatic text field focus.
|
||||
func showGlobalSearch()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user