mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Hook up the settings screen
This commit is contained in:
committed by
Stefan Ceriu
parent
35198460ce
commit
e6f269b9f2
@@ -55,6 +55,14 @@ struct Application: App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.handlesExternalEvents(matching: ["*"])
|
.handlesExternalEvents(matching: ["*"])
|
||||||
|
.commands {
|
||||||
|
CommandGroup(replacing: .appSettings) {
|
||||||
|
Button(L10n.commonSettings) {
|
||||||
|
appCoordinator.handleAppRoute(.settings, windowType: nil)
|
||||||
|
}
|
||||||
|
.keyboardShortcut(",", modifiers: .command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This is invoked in response of the WindowManager receiving a register
|
// This is invoked in response of the WindowManager receiving a register
|
||||||
// coordinator request and invoking the `OpenWindowAction` with which
|
// coordinator request and invoking the `OpenWindowAction` with which
|
||||||
|
|||||||
@@ -122,10 +122,14 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
case .accountProvisioningLink:
|
case .accountProvisioningLink:
|
||||||
break // We always ignore this flow when logged in.
|
break // We always ignore this flow when logged in.
|
||||||
case .settings, .chatBackupSettings:
|
case .settings, .chatBackupSettings:
|
||||||
if stateMachine.state != .settingsScreen {
|
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||||
stateMachine.tryEvent(.showSettingsScreen)
|
startSettingsFlow(detached: true)
|
||||||
|
} else {
|
||||||
|
if stateMachine.state != .settingsScreen {
|
||||||
|
stateMachine.tryEvent(.showSettingsScreen)
|
||||||
|
}
|
||||||
|
settingsFlowCoordinator?.handleAppRoute(appRoute, animated: animated)
|
||||||
}
|
}
|
||||||
settingsFlowCoordinator?.handleAppRoute(appRoute, animated: animated)
|
|
||||||
case .call(let roomID, let isVoiceCall):
|
case .call(let roomID, let isVoiceCall):
|
||||||
Task { await presentCallScreen(roomID: roomID, isVoiceCall: isVoiceCall) }
|
Task { await presentCallScreen(roomID: roomID, isVoiceCall: isVoiceCall) }
|
||||||
case .genericCallLink(let url):
|
case .genericCallLink(let url):
|
||||||
@@ -179,7 +183,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stateMachine.addRoutes(event: .showSettingsScreen, transitions: [.tabBar => .settingsScreen]) { [weak self] _ in
|
stateMachine.addRoutes(event: .showSettingsScreen, transitions: [.tabBar => .settingsScreen]) { [weak self] _ in
|
||||||
self?.startSettingsFlow()
|
self?.startSettingsFlow(detached: false)
|
||||||
}
|
}
|
||||||
stateMachine.addRoutes(event: .dismissedSettingsScreen, transitions: [.settingsScreen => .tabBar]) { [weak self] _ in
|
stateMachine.addRoutes(event: .dismissedSettingsScreen, transitions: [.settingsScreen => .tabBar]) { [weak self] _ in
|
||||||
self?.settingsFlowCoordinator = nil
|
self?.settingsFlowCoordinator = nil
|
||||||
@@ -303,7 +307,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
// MARK: - Settings
|
// MARK: - Settings
|
||||||
|
|
||||||
private func startSettingsFlow() {
|
private func startSettingsFlow(detached: Bool) {
|
||||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||||
let coordinator = SettingsFlowCoordinator(appLockService: appLockService,
|
let coordinator = SettingsFlowCoordinator(appLockService: appLockService,
|
||||||
navigationStackCoordinator: navigationStackCoordinator,
|
navigationStackCoordinator: navigationStackCoordinator,
|
||||||
@@ -331,11 +335,18 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
settingsFlowCoordinator = coordinator
|
|
||||||
coordinator.handleAppRoute(.settings, animated: false)
|
coordinator.handleAppRoute(.settings, animated: false)
|
||||||
|
|
||||||
navigationTabCoordinator.setSheetCoordinator(navigationStackCoordinator) { [weak self] in
|
if detached {
|
||||||
self?.stateMachine.tryEvent(.dismissedSettingsScreen)
|
flowParameters.windowManager.registerCoordinator(navigationStackCoordinator,
|
||||||
|
flowCoordinator: coordinator,
|
||||||
|
forWindowType: .settings)
|
||||||
|
} else {
|
||||||
|
settingsFlowCoordinator = coordinator
|
||||||
|
|
||||||
|
navigationTabCoordinator.setSheetCoordinator(navigationStackCoordinator) { [weak self] in
|
||||||
|
self?.stateMachine.tryEvent(.dismissedSettingsScreen)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ struct SettingsScreen: View {
|
|||||||
.compoundList()
|
.compoundList()
|
||||||
.navigationTitle(L10n.commonSettings)
|
.navigationTitle(L10n.commonSettings)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.toolbarVisibility(ProcessInfo.processInfo.isiOSAppOnMac ? .hidden : .automatic, for: .navigationBar)
|
||||||
.toolbar { toolbar }
|
.toolbar { toolbar }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user