Fix the Setup Recovery flow from the home screen banner. (#3483)

This commit is contained in:
Doug
2024-11-05 10:52:51 +00:00
committed by GitHub
parent 85d497a4d2
commit f3a15f7937
5 changed files with 13 additions and 3 deletions
@@ -466,6 +466,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
settingsFlowCoordinator.handleAppRoute(.settings, animated: true)
case .presentFeedbackScreen:
stateMachine.processEvent(.feedbackScreen)
case .presentSecureBackupSettings:
settingsFlowCoordinator.handleAppRoute(.chatBackupSettings, animated: true)
case .presentRecoveryKeyScreen:
stateMachine.processEvent(.showRecoveryKeyScreen)
case .presentEncryptionResetScreen:
@@ -20,6 +20,7 @@ enum HomeScreenCoordinatorAction {
case roomLeft(roomIdentifier: String)
case presentSettingsScreen
case presentFeedbackScreen
case presentSecureBackupSettings
case presentRecoveryKeyScreen
case presentEncryptionResetScreen
case presentStartChatScreen
@@ -64,6 +65,8 @@ final class HomeScreenCoordinator: CoordinatorProtocol {
actionsSubject.send(.presentFeedbackScreen)
case .presentSettingsScreen:
actionsSubject.send(.presentSettingsScreen)
case .presentSecureBackupSettings:
actionsSubject.send(.presentSecureBackupSettings)
case .presentRecoveryKeyScreen:
actionsSubject.send(.presentRecoveryKeyScreen)
case .presentEncryptionResetScreen:
@@ -13,6 +13,7 @@ enum HomeScreenViewModelAction {
case presentRoom(roomIdentifier: String)
case presentRoomDetails(roomIdentifier: String)
case roomLeft(roomIdentifier: String)
case presentSecureBackupSettings
case presentRecoveryKeyScreen
case presentEncryptionResetScreen
case presentSettingsScreen
@@ -31,7 +32,8 @@ enum HomeScreenViewAction {
case confirmLeaveRoom(roomIdentifier: String)
case showSettings
case startChat
case manageRecoveryKey
case setupRecovery
case confirmRecoveryKey
case resetEncryption
case skipRecoveryKeyConfirmation
case confirmSlidingSyncUpgrade
@@ -138,7 +138,9 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
Task { await leaveRoom(roomID: roomIdentifier) }
case .showSettings:
actionsSubject.send(.presentSettingsScreen)
case .manageRecoveryKey:
case .setupRecovery:
actionsSubject.send(.presentSecureBackupSettings)
case .confirmRecoveryKey:
actionsSubject.send(.presentRecoveryKeyScreen)
case .resetEncryption:
actionsSubject.send(.presentEncryptionResetScreen)
@@ -16,6 +16,7 @@ struct HomeScreenRecoveryKeyConfirmationBanner: View {
var title: String { requiresExtraAccountSetup ? L10n.bannerSetUpRecoveryTitle : L10n.confirmRecoveryKeyBannerTitle }
var message: String { requiresExtraAccountSetup ? L10n.bannerSetUpRecoveryContent : L10n.confirmRecoveryKeyBannerMessage }
var actionTitle: String { requiresExtraAccountSetup ? L10n.bannerSetUpRecoverySubmit : L10n.confirmRecoveryKeyBannerPrimaryButtonTitle }
var primaryAction: HomeScreenViewAction { requiresExtraAccountSetup ? .setupRecovery : .confirmRecoveryKey }
var body: some View {
VStack(spacing: 16) {
@@ -56,7 +57,7 @@ struct HomeScreenRecoveryKeyConfirmationBanner: View {
var buttons: some View {
VStack(spacing: 16) {
Button(actionTitle) {
context.send(viewAction: .manageRecoveryKey)
context.send(viewAction: primaryAction)
}
.frame(maxWidth: .infinity)
.buttonStyle(.compound(.primary, size: .medium))