mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Disable multiple windows when screen lock is enabled.
This commit is contained in:
committed by
Stefan Ceriu
parent
b7333b9b5f
commit
3b858a4073
@@ -188,6 +188,12 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
windowManager.auxiliaryWindowsEnabled = !appLockService.isEnabled
|
||||
appLockService.isEnabledPublisher.sink { [weak windowManager] appLockEnabled in
|
||||
windowManager?.auxiliaryWindowsEnabled = !appLockEnabled
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func start() {
|
||||
|
||||
@@ -22,6 +22,14 @@ class WindowManager: SecureWindowManagerProtocol {
|
||||
|
||||
private(set) var openWindowAction: OpenWindowAction!
|
||||
private(set) var dismissWindowAction: DismissWindowAction!
|
||||
|
||||
var auxiliaryWindowsEnabled = true {
|
||||
didSet {
|
||||
if auxiliaryWindowsEnabled == false {
|
||||
closeAllAuxiliaryWindows()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var windows: [UIWindow] {
|
||||
[mainWindow, overlayWindow, globalSearchWindow, alternateWindow]
|
||||
@@ -167,6 +175,11 @@ class WindowManager: SecureWindowManagerProtocol {
|
||||
}
|
||||
|
||||
func registerCoordinator(_ coordinator: CoordinatorProtocol, flowCoordinator: FlowCoordinatorProtocol?, forWindowType type: WindowManagerWindowType) {
|
||||
if auxiliaryWindowsEnabled == false {
|
||||
MXLog.error("Cannot register coordinator, auxiliary windows are disabled.")
|
||||
return
|
||||
}
|
||||
|
||||
coordinators[type] = (coordinator, flowCoordinator)
|
||||
openWindowAction(value: type)
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ protocol WindowManagerProtocol: AnyObject, OrientationManagerProtocol {
|
||||
|
||||
// MARK: - Auxiliary window support
|
||||
|
||||
var auxiliaryWindowsEnabled: 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,
|
||||
|
||||
Reference in New Issue
Block a user