Reset Recovery Key Screen (#2648)
Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,7 @@ enum SecureBackupRecoveryKeyScreenCoordinatorAction {
|
||||
case recoverySetUp
|
||||
case recoveryChanged
|
||||
case recoveryFixed
|
||||
case showResetKeyInfo
|
||||
}
|
||||
|
||||
final class SecureBackupRecoveryKeyScreenCoordinator: CoordinatorProtocol {
|
||||
@@ -62,6 +63,8 @@ final class SecureBackupRecoveryKeyScreenCoordinator: CoordinatorProtocol {
|
||||
case .fixRecovery:
|
||||
self.actionsSubject.send(.recoveryFixed)
|
||||
}
|
||||
case .showResetKeyInfo:
|
||||
self.actionsSubject.send(.showResetKeyInfo)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -19,6 +19,7 @@ import Foundation
|
||||
enum SecureBackupRecoveryKeyScreenViewModelAction {
|
||||
case done(mode: SecureBackupRecoveryKeyScreenViewMode)
|
||||
case cancel
|
||||
case showResetKeyInfo
|
||||
}
|
||||
|
||||
enum SecureBackupRecoveryKeyScreenViewMode {
|
||||
@@ -82,6 +83,7 @@ enum SecureBackupRecoveryKeyScreenViewAction {
|
||||
case copyKey
|
||||
case keySaved
|
||||
case confirmKey
|
||||
case resetKey
|
||||
case done
|
||||
case cancel
|
||||
}
|
||||
|
||||
@@ -100,6 +100,8 @@ class SecureBackupRecoveryKeyScreenViewModel: SecureBackupRecoveryKeyScreenViewM
|
||||
guard let self else { return }
|
||||
actionsSubject.send(.done(mode: context.viewState.mode))
|
||||
}))
|
||||
case .resetKey:
|
||||
actionsSubject.send(.showResetKeyInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,12 @@ struct SecureBackupRecoveryKeyScreen: View {
|
||||
case .setupRecovery, .changeRecovery:
|
||||
recoveryCreatedActionButtons
|
||||
case .fixRecovery:
|
||||
incompleteVerificationActionButtons
|
||||
}
|
||||
}
|
||||
|
||||
private var incompleteVerificationActionButtons: some View {
|
||||
VStack(spacing: 16) {
|
||||
Button {
|
||||
context.send(viewAction: .confirmKey)
|
||||
} label: {
|
||||
@@ -71,6 +77,14 @@ struct SecureBackupRecoveryKeyScreen: View {
|
||||
}
|
||||
.buttonStyle(.compound(.primary))
|
||||
.disabled(context.confirmationRecoveryKey.isEmpty)
|
||||
|
||||
Button {
|
||||
context.send(viewAction: .resetKey)
|
||||
} label: {
|
||||
Text(L10n.screenIdentityConfirmationCreateNewRecoveryKey)
|
||||
.padding(.vertical, 14)
|
||||
}
|
||||
.buttonStyle(.compound(.plain))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +141,7 @@ struct SecureBackupRecoveryKeyScreen: View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text(L10n.commonRecoveryKey)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.font(.compound.bodySM)
|
||||
.font(.compound.bodySMSemibold)
|
||||
|
||||
Group {
|
||||
if context.viewState.recoveryKey == nil {
|
||||
@@ -180,7 +194,7 @@ struct SecureBackupRecoveryKeyScreen: View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text(L10n.commonRecoveryKey)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.font(.compound.bodySM)
|
||||
.font(.compound.bodySMSemibold)
|
||||
|
||||
SecureField(L10n.screenRecoveryKeyConfirmKeyPlaceholder, text: $context.confirmationRecoveryKey)
|
||||
.textContentType(.password) // Not ideal but stops random suggestions
|
||||
|
||||
Reference in New Issue
Block a user