mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Rename "Auxiliary" windows to "Secondary" windows
This commit is contained in:
committed by
Stefan Ceriu
parent
ec9cf76f2d
commit
4abf9112f4
@@ -23,10 +23,10 @@ class WindowManager: SecureWindowManagerProtocol {
|
||||
private(set) var openWindowAction: OpenWindowAction!
|
||||
private(set) var dismissWindowAction: DismissWindowAction!
|
||||
|
||||
var auxiliaryWindowsEnabled = true {
|
||||
var secondaryWindowsEnabled = true {
|
||||
didSet {
|
||||
if auxiliaryWindowsEnabled == false {
|
||||
closeAllAuxiliaryWindows()
|
||||
if secondaryWindowsEnabled == false {
|
||||
closeAllSecondaryWindows()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class WindowManager: SecureWindowManagerProtocol {
|
||||
/// A duration that allows window switching to wait a couple of frames to avoid a transition through black.
|
||||
private let windowHideDelay = Duration.milliseconds(33)
|
||||
|
||||
private var coordinators: [WindowManagerWindowType: (coordinator: CoordinatorProtocol, flowCoordinator: FlowCoordinatorProtocol?)] = [:]
|
||||
private var coordinators: [SecondaryWindowType: (coordinator: CoordinatorProtocol, flowCoordinator: FlowCoordinatorProtocol?)] = [:]
|
||||
|
||||
init(appDelegate: AppDelegate) {
|
||||
self.appDelegate = appDelegate
|
||||
@@ -82,7 +82,7 @@ class WindowManager: SecureWindowManagerProtocol {
|
||||
self.dismissWindowAction = dismissWindowAction
|
||||
}
|
||||
|
||||
func handleRoute(_ appRoute: AppRoute, windowType: WindowManagerWindowType) {
|
||||
func handleRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType) {
|
||||
if let flowCoordinator = coordinators[windowType]?.flowCoordinator {
|
||||
flowCoordinator.handleAppRoute(appRoute, animated: true)
|
||||
}
|
||||
@@ -160,9 +160,9 @@ class WindowManager: SecureWindowManagerProtocol {
|
||||
appDelegate.orientationLock = orientation
|
||||
}
|
||||
|
||||
// MARK: - Auxiliary window support
|
||||
// MARK: - Secondary window support
|
||||
|
||||
func windowForType(_ type: WindowManagerWindowType) -> AnyView {
|
||||
func windowForType(_ type: SecondaryWindowType) -> AnyView {
|
||||
guard let coordinator = coordinators[type]?.coordinator else {
|
||||
return AnyView(InstantlyDismissingWindow())
|
||||
}
|
||||
@@ -174,9 +174,9 @@ class WindowManager: SecureWindowManagerProtocol {
|
||||
})
|
||||
}
|
||||
|
||||
func registerCoordinator(_ coordinator: CoordinatorProtocol, flowCoordinator: FlowCoordinatorProtocol?, forWindowType type: WindowManagerWindowType) {
|
||||
if auxiliaryWindowsEnabled == false {
|
||||
MXLog.error("Cannot register coordinator, auxiliary windows are disabled.")
|
||||
func registerCoordinator(_ coordinator: CoordinatorProtocol, flowCoordinator: FlowCoordinatorProtocol?, forWindowType type: SecondaryWindowType) {
|
||||
if secondaryWindowsEnabled == false {
|
||||
MXLog.error("Cannot register coordinator, secondary windows are disabled.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -184,11 +184,11 @@ class WindowManager: SecureWindowManagerProtocol {
|
||||
openWindowAction(value: type)
|
||||
}
|
||||
|
||||
func closeAuxiliaryWindow(forType type: WindowManagerWindowType) {
|
||||
func closeSecondaryWindow(forType type: SecondaryWindowType) {
|
||||
dismissWindowAction(value: type)
|
||||
}
|
||||
|
||||
func closeAllAuxiliaryWindows() {
|
||||
func closeAllSecondaryWindows() {
|
||||
for key in coordinators.keys {
|
||||
dismissWindowAction(value: key)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum WindowManagerWindowType: Hashable, Codable {
|
||||
enum SecondaryWindowType: Hashable, Codable {
|
||||
case room(roomID: String)
|
||||
case settings
|
||||
}
|
||||
@@ -27,7 +27,7 @@ protocol SecureWindowManagerProtocol: WindowManagerProtocol {
|
||||
|
||||
func configure(withOpenWinddowAction openWindowAction: OpenWindowAction, dismissWindowAction: DismissWindowAction)
|
||||
|
||||
func handleRoute(_ appRoute: AppRoute, windowType: WindowManagerWindowType)
|
||||
func handleRoute(_ appRoute: AppRoute, windowType: SecondaryWindowType)
|
||||
|
||||
/// Shows the main and overlay window combo, hiding the alternate window.
|
||||
func switchToMain()
|
||||
@@ -35,10 +35,10 @@ protocol SecureWindowManagerProtocol: WindowManagerProtocol {
|
||||
/// Shows the alternate window, hiding the main and overlay combo.
|
||||
func switchToAlternate()
|
||||
|
||||
// MARK: - Auxiliary window support
|
||||
// MARK: - Secondary window support
|
||||
|
||||
/// Used by the Application to retrieve the root view for an auxiliary window
|
||||
func windowForType(_ type: WindowManagerWindowType) -> AnyView
|
||||
/// 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
|
||||
@@ -62,21 +62,21 @@ protocol WindowManagerProtocol: AnyObject, OrientationManagerProtocol {
|
||||
|
||||
func hideGlobalSearch()
|
||||
|
||||
// MARK: - Auxiliary window support
|
||||
// MARK: - Secondary window support
|
||||
|
||||
var auxiliaryWindowsEnabled: Bool { get set }
|
||||
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: WindowManagerWindowType)
|
||||
forWindowType type: SecondaryWindowType)
|
||||
|
||||
/// Closes any window previously opened by registering a coordinator
|
||||
func closeAllAuxiliaryWindows()
|
||||
func closeAllSecondaryWindows()
|
||||
|
||||
/// Closes a previously opened window for the given type.
|
||||
func closeAuxiliaryWindow(forType type: WindowManagerWindowType)
|
||||
func closeSecondaryWindow(forType type: SecondaryWindowType)
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
|
||||
Reference in New Issue
Block a user