mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Add a logout option on the root of IdentityVerification screen.
This commit is contained in:
committed by
Stefan Ceriu
parent
904045f178
commit
32e1e1aa24
@@ -18,6 +18,10 @@ import Combine
|
||||
import Foundation
|
||||
import SwiftState
|
||||
|
||||
enum OnboardingFlowCoordinatorAction {
|
||||
case logout
|
||||
}
|
||||
|
||||
class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
|
||||
private let userSession: UserSessionProtocol
|
||||
private let appLockService: AppLockServiceProtocol
|
||||
@@ -52,6 +56,11 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
|
||||
// periphery: ignore - used to store the coordinator to avoid deallocation
|
||||
private var appLockFlowCoordinator: AppLockSetupFlowCoordinator?
|
||||
|
||||
private let actionsSubject: PassthroughSubject<OnboardingFlowCoordinatorAction, Never> = .init()
|
||||
var actions: AnyPublisher<OnboardingFlowCoordinatorAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(userSession: UserSessionProtocol,
|
||||
appLockService: AppLockServiceProtocol,
|
||||
analyticsService: AnalyticsService,
|
||||
@@ -234,6 +243,8 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
|
||||
stateMachine.tryEvent(.nextSkippingIdentityConfimed)
|
||||
case .reset:
|
||||
presentEncryptionResetScreen()
|
||||
case .logout:
|
||||
actionsSubject.send(.logout)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -185,6 +185,17 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
onboardingFlowCoordinator.actions
|
||||
.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
|
||||
switch action {
|
||||
case .logout:
|
||||
logout()
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func start() {
|
||||
@@ -429,12 +440,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
}
|
||||
|
||||
guard isLastDevice else {
|
||||
ServiceLocator.shared.userIndicatorController.alertInfo = .init(id: .init(),
|
||||
title: L10n.screenSignoutConfirmationDialogTitle,
|
||||
message: L10n.screenSignoutConfirmationDialogContent,
|
||||
primaryButton: .init(title: L10n.screenSignoutConfirmationDialogSubmit, role: .destructive) { [weak self] in
|
||||
self?.actionsSubject.send(.logout)
|
||||
})
|
||||
logout()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -465,6 +471,15 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
presentSecureBackupLogoutConfirmationScreen()
|
||||
}
|
||||
|
||||
private func logout() {
|
||||
ServiceLocator.shared.userIndicatorController.alertInfo = .init(id: .init(),
|
||||
title: L10n.screenSignoutConfirmationDialogTitle,
|
||||
message: L10n.screenSignoutConfirmationDialogContent,
|
||||
primaryButton: .init(title: L10n.screenSignoutConfirmationDialogSubmit, role: .destructive) { [weak self] in
|
||||
self?.actionsSubject.send(.logout)
|
||||
})
|
||||
}
|
||||
|
||||
// MARK: Room Flow
|
||||
|
||||
private func startRoomFlow(roomID: String,
|
||||
|
||||
Reference in New Issue
Block a user