Skip to content

Commit

Permalink
Remove possibility to proceed for backup on save without password (#1387
Browse files Browse the repository at this point in the history
)
  • Loading branch information
yevhen1sec authored Nov 21, 2024
1 parent 7a650df commit 3e08e61
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,9 @@ internal class BackupPasswordViewModel @Inject constructor(
}

fun backupEncryptedVault() {
if (shouldEnableEncryption()) {
if (validateConfirmPassword()) {
val password = passwordTextFieldState.text.toString()
backupVault(password)
}
} else {
backupVault(null)
if (validateConfirmPassword()) {
val password = passwordTextFieldState.text.toString()
backupVault(password)
}
}

Expand All @@ -143,17 +139,17 @@ internal class BackupPasswordViewModel @Inject constructor(
return fileName
}

private fun shouldEnableEncryption(): Boolean {
val enabled = (passwordTextFieldState.text.toString().isNotEmpty()
|| confirmPasswordTextFieldState.text.toString().isNotEmpty())
return enabled
}

fun validateConfirmPassword(): Boolean {
val errorMessage =
if (passwordTextFieldState.text.toString() != confirmPasswordTextFieldState.text.toString())
UiText.StringResource(R.string.backup_password_screen_confirm_password_error_message)
else null
when {
passwordTextFieldState.text.toString().isEmpty() -> {
UiText.StringResource(R.string.backup_password_screen_empty_password)
}
passwordTextFieldState.text.toString() != confirmPasswordTextFieldState.text.toString() -> {
UiText.StringResource(R.string.backup_password_screen_confirm_password_error_message)
}
else -> null
}

uiState.update {
it.copy(confirmPasswordErrorMessage = errorMessage)
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@
<string name="import_file_screen_password_error">Das Passwort ist nicht korrekt.</string>
<string name="backup_password_optional_password_protection">Optionaler Passwortschutz für Ihren Tresor</string>
<string name="backup_password_screen_save">Speichern</string>
<string name="backup_password_screen_skip">Überspringen</string>
<string name="backup_password_screen_enter_password">Passwort eingeben</string>
<string name="import_file_screen_enter_password">Passwort eingeben</string>
<string name="backup_password_screen_verify_password">Kennwort bestätigen</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@
<string name="import_file_screen_password_error">La contraseña no es correcta.</string>
<string name="backup_password_optional_password_protection">Protección con contraseña opcional de su bóveda</string>
<string name="backup_password_screen_save">Guardar</string>
<string name="backup_password_screen_skip">Saltar</string>
<string name="backup_password_screen_enter_password">Introducir contraseña</string>
<string name="import_file_screen_enter_password">Introducir contraseña</string>
<string name="backup_password_screen_verify_password">Verificar contraseña</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@
<string name="import_file_screen_password_error">Lozinka nije ispravna.</string>
<string name="backup_password_optional_password_protection">Dodatna zaštita lozinkom vašeg trezora</string>
<string name="backup_password_screen_save">Uštedjeti</string>
<string name="backup_password_screen_skip">Preskočiti</string>
<string name="backup_password_screen_enter_password">Unesite lozinku</string>
<string name="import_file_screen_enter_password">Unesite lozinku</string>
<string name="backup_password_screen_verify_password">Potvrdi lozinku</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@
<string name="import_file_screen_password_error">La password non è corretta.</string>
<string name="backup_password_optional_password_protection">Protezione facoltativa tramite password del tuo Vault</string>
<string name="backup_password_screen_save">Salva</string>
<string name="backup_password_screen_skip">Saltare</string>
<string name="backup_password_screen_enter_password">Inserisci la password</string>
<string name="import_file_screen_enter_password">Inserisci la password</string>
<string name="backup_password_screen_verify_password">Verifica password</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
<string name="import_file_screen_password_error">Wachtwoord is niet correct.</string>
<string name="backup_password_optional_password_protection">Optionele wachtwoordbeveiliging van uw kluis</string>
<string name="backup_password_screen_save">Redden</string>
<string name="backup_password_screen_skip">Skip</string>
<string name="backup_password_screen_enter_password">Voer wachtwoord in</string>
<string name="import_file_screen_enter_password">Voer wachtwoord in</string>
<string name="backup_password_screen_verify_password">Wachtwoord verifiëren</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@
<string name="import_file_screen_password_error">A palavra-passe não está correta.</string>
<string name="backup_password_optional_password_protection">Proteção opcional por palavra-passe do seu Vault</string>
<string name="backup_password_screen_save">Guardar</string>
<string name="backup_password_screen_skip">Ignorar</string>
<string name="backup_password_screen_enter_password">Introduza a senha</string>
<string name="import_file_screen_enter_password">Introduza a senha</string>
<string name="backup_password_screen_verify_password">Verifique a palavra-passe</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@
<string name="import_file_screen_password_error">Пароль неверный.</string>
<string name="backup_password_optional_password_protection">Дополнительная защита вашего хранилища паролем</string>
<string name="backup_password_screen_save">Сохранять</string>
<string name="backup_password_screen_skip">Пропускать</string>
<string name="backup_password_screen_enter_password">Введите пароль</string>
<string name="import_file_screen_enter_password">Введите пароль</string>
<string name="backup_password_screen_verify_password">Подтвердите пароль</string>
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
<string name="import_file_screen_password_error">Password is not correct.</string>
<string name="backup_password_optional_password_protection">Optional password protection of your Vault</string>
<string name="backup_password_screen_save">Save</string>
<string name="backup_password_screen_skip">Skip</string>

<string name="backup_password_screen_enter_password">Enter Password</string>
<string name="import_file_screen_enter_password">Enter Password</string>
<string name="backup_password_screen_verify_password">Verify password</string>
Expand Down Expand Up @@ -481,5 +481,7 @@
<string name="swap_screen_invalid_zero_token_amount" translatable="false">Token amount cannot be Zero</string>
<string name="swap_screen_invalid_gas_fee_calculation" translatable="false">Gas fee calculation failed</string>
<string name="swap_screen_invalid_quote_calculation" translatable="false">Quote calculation failed</string>
<string name="backup_password_screen_skip" translatable="false">Skip Password</string>
<string name="backup_password_screen_empty_password" translatable="false">Please use \"Skip Password\" to save without password</string>
<string name="network_connection_lost" translatable="false">Network connection lost. Please check your internet connection</string>
</resources>

0 comments on commit 3e08e61

Please sign in to comment.