mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Secure backup tweaks (#2095)
* Show a loading indicator when confirming the recovery key * Hide the passphrase characters when confirming the recovery key * Don't show the settings security section until session verification state is retrieved (async) * Fix preview screenshots
This commit is contained in:
parent
22742620c5
commit
d245a4f158
@ -72,6 +72,9 @@ class SecureBackupRecoveryKeyScreenViewModel: SecureBackupRecoveryKeyScreenViewM
|
||||
state.doneButtonEnabled = true
|
||||
case .confirmKey:
|
||||
Task {
|
||||
let loadingIndicatorIdentifier = "SecureBackupRecoveryKeyScreen"
|
||||
userIndicatorController.submitIndicator(.init(id: loadingIndicatorIdentifier, type: .modal, title: L10n.commonLoading, persistent: true))
|
||||
|
||||
switch await secureBackupController.confirmRecoveryKey(state.bindings.confirmationRecoveryKey) {
|
||||
case .success:
|
||||
actionsSubject.send(.done(mode: context.viewState.mode))
|
||||
@ -79,6 +82,8 @@ class SecureBackupRecoveryKeyScreenViewModel: SecureBackupRecoveryKeyScreenViewM
|
||||
MXLog.error("Failed confirming recovery key with error: \(error)")
|
||||
state.bindings.alertInfo = .init(id: .init())
|
||||
}
|
||||
|
||||
userIndicatorController.retractIndicatorWithId(loadingIndicatorIdentifier)
|
||||
}
|
||||
case .cancel:
|
||||
actionsSubject.send(.cancel)
|
||||
|
@ -179,7 +179,7 @@ struct SecureBackupRecoveryKeyScreen: View {
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.font(.compound.bodySM)
|
||||
|
||||
TextField(L10n.screenRecoveryKeyConfirmKeyPlaceholder, text: $context.confirmationRecoveryKey)
|
||||
SecureField(L10n.screenRecoveryKeyConfirmKeyPlaceholder, text: $context.confirmationRecoveryKey)
|
||||
.textContentType(.password) // Not ideal but stops random suggestions
|
||||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
|
@ -41,7 +41,7 @@ struct SettingsScreenViewState: BindableState {
|
||||
var accountSessionsListURL: URL?
|
||||
var userAvatarURL: URL?
|
||||
var userDisplayName: String?
|
||||
var isSessionVerified = false
|
||||
var isSessionVerified: Bool?
|
||||
var chatBackupEnabled = false
|
||||
var showSecureBackupBadge = false
|
||||
var showDeveloperOptions: Bool
|
||||
|
@ -84,9 +84,9 @@ struct SettingsScreen: View {
|
||||
|
||||
@ViewBuilder
|
||||
private var accountSecuritySection: some View {
|
||||
if !context.viewState.isSessionVerified || context.viewState.chatBackupEnabled {
|
||||
Section {
|
||||
if !context.viewState.isSessionVerified {
|
||||
Section {
|
||||
if let isSessionVerified = context.viewState.isSessionVerified {
|
||||
if !isSessionVerified {
|
||||
ListRow(label: .default(title: L10n.actionCompleteVerification,
|
||||
icon: \.checkCircle),
|
||||
kind: .button { context.send(viewAction: .sessionVerification) })
|
||||
|
BIN
UnitTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen.Incomplete.png
(Stored with Git LFS)
BIN
UnitTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen.Incomplete.png
(Stored with Git LFS)
Binary file not shown.
BIN
UnitTests/__Snapshots__/PreviewTests/test_settingsScreen.1.png
(Stored with Git LFS)
BIN
UnitTests/__Snapshots__/PreviewTests/test_settingsScreen.1.png
(Stored with Git LFS)
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user