Fixes for multi-window support. (#5528)

* Correctly handle the re-opening of the main window.

Add an additional safe-guard to ensure only one main window exists.
Make sure all secondary windows use the correct tint colour.

* Fix a bug where the settings screen isn't shown on macOS when the AppLock feature is enabled.
This commit is contained in:
Doug
2026-05-01 14:44:04 +01:00
committed by GitHub
parent c1184b748d
commit 9015c3e483
11 changed files with 77 additions and 17 deletions
@@ -19,6 +19,7 @@ enum SettingsFlowCoordinatorAction {
class SettingsFlowCoordinator: FlowCoordinatorProtocol {
private let appLockService: AppLockServiceProtocol
private let isInSecondaryWindow: Bool
private let navigationStackCoordinator: NavigationStackCoordinator
private let flowParameters: CommonFlowParameters
@@ -39,9 +40,11 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
}
init(appLockService: AppLockServiceProtocol,
isInSecondaryWindow: Bool,
navigationStackCoordinator: NavigationStackCoordinator,
flowParameters: CommonFlowParameters) {
self.appLockService = appLockService
self.isInSecondaryWindow = isInSecondaryWindow
self.navigationStackCoordinator = navigationStackCoordinator
self.flowParameters = flowParameters
}
@@ -72,7 +75,8 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
private func presentSettingsScreen(animated: Bool) {
let settingsScreenCoordinator = SettingsScreenCoordinator(parameters: .init(userSession: flowParameters.userSession,
appSettings: flowParameters.appSettings,
isBugReportServiceEnabled: flowParameters.bugReportService.isEnabled))
isBugReportServiceEnabled: flowParameters.bugReportService.isEnabled,
isInSecondaryWindow: isInSecondaryWindow))
settingsScreenCoordinator.actions
.sink { [weak self] action in
@@ -124,7 +124,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
case .accountProvisioningLink:
break // We always ignore this flow when logged in.
case .settings, .chatBackupSettings:
if ProcessInfo.processInfo.isiOSAppOnMac {
if ProcessInfo.processInfo.isiOSAppOnMac, flowParameters.windowManager.secondaryWindowsEnabled {
startSettingsFlow(detached: true)
} else {
if stateMachine.state != .settingsScreen {
@@ -310,6 +310,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
private func startSettingsFlow(detached: Bool) {
let navigationStackCoordinator = NavigationStackCoordinator()
let coordinator = SettingsFlowCoordinator(appLockService: appLockService,
isInSecondaryWindow: detached,
navigationStackCoordinator: navigationStackCoordinator,
flowParameters: flowParameters)