Fixes #2470 - Allow verifiying a session through entering the recovery key

This commit is contained in:
Stefan Ceriu
2024-02-19 10:10:25 +02:00
committed by Stefan Ceriu
parent 46f0cf45bd
commit 023e10edf2
17 changed files with 73 additions and 32 deletions
@@ -208,7 +208,8 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
fatalError("The sessionVerificationController should aways be valid at this point")
}
let verificationParameters = SessionVerificationScreenCoordinatorParameters(sessionVerificationControllerProxy: sessionVerificationController)
let verificationParameters = SessionVerificationScreenCoordinatorParameters(sessionVerificationControllerProxy: sessionVerificationController,
recoveryState: parameters.userSession.sessionSecurityStatePublisher.value.recoveryState)
let coordinator = SessionVerificationScreenCoordinator(parameters: verificationParameters)
coordinator.actions
@@ -216,6 +217,9 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
guard let self else { return }
switch action {
case .recoveryKey:
navigationStackCoordinator.setSheetCoordinator(nil)
handleAppRoute(.chatBackupSettings, animated: true)
case .done:
navigationStackCoordinator.setSheetCoordinator(nil)
}
@@ -270,7 +270,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
break
case (.roomList, .showLogoutConfirmationScreen, .logoutConfirmationScreen):
presentSecureBackupConfirmationScreen()
presentSecureBackupLogoutConfirmationScreen()
case (.logoutConfirmationScreen, .dismissedLogoutConfirmationScreen, .roomList):
break
@@ -400,7 +400,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
return
}
presentSecureBackupConfirmationScreen()
presentSecureBackupLogoutConfirmationScreen()
}
// MARK: Session verification
@@ -410,7 +410,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
fatalError("The sessionVerificationController should aways be valid at this point")
}
let parameters = SessionVerificationScreenCoordinatorParameters(sessionVerificationControllerProxy: sessionVerificationController)
let parameters = SessionVerificationScreenCoordinatorParameters(sessionVerificationControllerProxy: sessionVerificationController,
recoveryState: userSession.sessionSecurityStatePublisher.value.recoveryState)
let coordinator = SessionVerificationScreenCoordinator(parameters: parameters)
@@ -419,6 +420,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
guard let self else { return }
switch action {
case .recoveryKey:
settingsFlowCoordinator.handleAppRoute(.chatBackupSettings, animated: true)
case .done:
navigationSplitCoordinator.setSheetCoordinator(nil)
}
@@ -511,7 +514,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
// MARK: Secure backup confirmation
private func presentSecureBackupConfirmationScreen() {
private func presentSecureBackupLogoutConfirmationScreen() {
let coordinator = SecureBackupLogoutConfirmationScreenCoordinator(parameters: .init(secureBackupController: userSession.clientProxy.secureBackupController,
networkMonitor: ServiceLocator.shared.networkMonitor))