diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapBottomSheet.kt b/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapBottomSheet.kt index 60490fc812..26c8ed25f9 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapBottomSheet.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapBottomSheet.kt @@ -122,43 +122,50 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment() { override fun invalidate() = withState(viewModel) { state -> when (state.step) { - is BootstrapStep.CheckingMigration -> { + is BootstrapStep.CheckingMigration -> { bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_message_password)) bootstrapTitleText.text = getString(R.string.upgrade_security) showFragment(BootstrapWaitingFragment::class, Bundle()) } - is BootstrapStep.SetupPassphrase -> { + is BootstrapStep.SetupPassphrase -> { bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_message_password)) bootstrapTitleText.text = getString(R.string.set_recovery_passphrase, getString(R.string.recovery_passphrase)) showFragment(BootstrapEnterPassphraseFragment::class, Bundle()) } - is BootstrapStep.ConfirmPassphrase -> { + is BootstrapStep.ConfirmPassphrase -> { bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_message_password)) bootstrapTitleText.text = getString(R.string.confirm_recovery_passphrase, getString(R.string.recovery_passphrase)) showFragment(BootstrapConfirmPassphraseFragment::class, Bundle()) } - is BootstrapStep.AccountPassword -> { + is BootstrapStep.AccountPassword -> { bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_user)) bootstrapTitleText.text = getString(R.string.account_password) showFragment(BootstrapAccountPasswordFragment::class, Bundle()) } - is BootstrapStep.Initializing -> { + is BootstrapStep.Initializing -> { bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_message_key)) bootstrapTitleText.text = getString(R.string.bootstrap_loading_title) showFragment(BootstrapWaitingFragment::class, Bundle()) } - is BootstrapStep.SaveRecoveryKey -> { + is BootstrapStep.SaveRecoveryKey -> { bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_message_key)) bootstrapTitleText.text = getString(R.string.keys_backup_setup_step3_please_make_copy) showFragment(BootstrapSaveRecoveryKeyFragment::class, Bundle()) } - is BootstrapStep.DoneSuccess -> { + is BootstrapStep.DoneSuccess -> { bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_message_key)) bootstrapTitleText.text = getString(R.string.bootstrap_finish_title) showFragment(BootstrapConclusionFragment::class, Bundle()) } is BootstrapStep.GetBackupSecretForMigration -> { - bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.key_small)) + val isKey = when (state.step) { + is BootstrapStep.GetBackupSecretPassForMigration -> state.step.useKey + else -> true + } + bootstrapIcon.setImageDrawable(ContextCompat.getDrawable( + requireContext(), + R.drawable.ic_message_key.takeIf { isKey } ?: R.drawable.ic_message_password) + ) bootstrapTitleText.text = getString(R.string.upgrade_security) showFragment(BootstrapMigrateBackupFragment::class, Bundle()) } diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapMigrateBackupFragment.kt b/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapMigrateBackupFragment.kt index 844a16977c..589f397864 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapMigrateBackupFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/recover/BootstrapMigrateBackupFragment.kt @@ -125,7 +125,8 @@ class BootstrapMigrateBackupFragment @Inject constructor( val secret = bootstrapMigrateEditText.text?.toString() if (secret.isNullOrBlank()) { - bootstrapRecoveryKeyEnterTil.error = getString(R.string.passphrase_empty_error_message) + bootstrapRecoveryKeyEnterTil.error = getString(R.string.recovery_key_empty_error_message).takeIf { isEnteringKey } + ?: getString(R.string.passphrase_empty_error_message) } else if (isEnteringKey && !isValidRecoveryKey(secret)) { bootstrapRecoveryKeyEnterTil.error = getString(R.string.bootstrap_invalid_recovery_key) } else { @@ -153,14 +154,14 @@ class BootstrapMigrateBackupFragment @Inject constructor( bootstrapMigrateShowPassword.isVisible = false bootstrapMigrateEditText.inputType = TYPE_CLASS_TEXT or TYPE_TEXT_VARIATION_VISIBLE_PASSWORD or TYPE_TEXT_FLAG_MULTI_LINE - val recKey = getString(R.string.recovery_key) + val recKey = getString(R.string.bootstrap_migration_backup_recovery_key) bootstrapDescriptionText.text = getString(R.string.enter_account_password, recKey) .toSpannable() .colorizeMatchingText(recKey, colorProvider.getColorFromAttribute(android.R.attr.textColorLink)) bootstrapMigrateEditText.hint = recKey - bootstrapMigrateEditText.hint = getString(R.string.keys_backup_restore_key_enter_hint) + bootstrapMigrateEditText.hint = recKey bootstrapMigrateForgotPassphrase.isVisible = false bootstrapMigrateUseFile.isVisible = true } else { @@ -172,19 +173,16 @@ class BootstrapMigrateBackupFragment @Inject constructor( bootstrapMigrateShowPassword.setImageResource(if (isPasswordVisible) R.drawable.ic_eye_closed_black else R.drawable.ic_eye_black) } - val recPassPhrase = getString(R.string.backup_recovery_passphrase) - bootstrapDescriptionText.text = getString(R.string.enter_account_password, recPassPhrase) - .toSpannable() - .colorizeMatchingText(recPassPhrase, colorProvider.getColorFromAttribute(android.R.attr.textColorLink)) + bootstrapDescriptionText.text = getString(R.string.bootstrap_migration_enter_backup_password) bootstrapMigrateEditText.hint = getString(R.string.passphrase_enter_passphrase) bootstrapMigrateForgotPassphrase.isVisible = true - val recKeye = getString(R.string.keys_backup_restore_use_recovery_key) - bootstrapMigrateForgotPassphrase.text = getString(R.string.keys_backup_restore_with_passphrase_helper_with_link, recKeye) + val recKey = getString(R.string.bootstrap_migration_use_recovery_key) + bootstrapMigrateForgotPassphrase.text = getString(R.string.bootstrap_migration_with_passphrase_helper_with_link, recKey) .toSpannable() - .colorizeMatchingText(recKeye, colorProvider.getColorFromAttribute(android.R.attr.textColorLink)) + .colorizeMatchingText(recKey, colorProvider.getColorFromAttribute(android.R.attr.textColorLink)) bootstrapMigrateUseFile.isVisible = false } diff --git a/vector/src/main/res/drawable/ic_message_key.xml b/vector/src/main/res/drawable/ic_message_key.xml index c4a415477b..9c5e53571d 100644 --- a/vector/src/main/res/drawable/ic_message_key.xml +++ b/vector/src/main/res/drawable/ic_message_key.xml @@ -7,13 +7,10 @@ + android:strokeColor="#2E2F32"/> + android:strokeColor="#2E2F32"/> Verify your devices from Settings. Verification Cancelled - Message Password + Recovery Passphrase Message Key Account Password @@ -2269,8 +2269,8 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming You cannot do that from mobile - Setting a Message Password lets you secure & unlock encrypted messages and trust.\n\nIf you don’t want to set a Message Password, generate a Message Key instead. - Setting a Message Password lets you secure & unlock encrypted messages and trust. + Setting a Recovery Passphrase lets you secure & unlock encrypted messages and trust.\n\nIf you don’t want to set a Message Password, generate a Message Key instead. + Setting a Recovery Passphrase lets you secure & unlock encrypted messages and trust. Encryption enabled diff --git a/vector/src/main/res/values/strings_riotX.xml b/vector/src/main/res/values/strings_riotX.xml index 90496c351d..9d9d3deb07 100644 --- a/vector/src/main/res/values/strings_riotX.xml +++ b/vector/src/main/res/values/strings_riotX.xml @@ -20,6 +20,7 @@ Enter %s Recovery Passphrase "It's not a valid recovery key" + Please enter a recovery key Checking backup Key Checking backup Key (%s) @@ -30,6 +31,14 @@ Storing keybackup secret in SSSS %1$s (%2$s) + + + Enter your Key Backup Passphrase to continue. + use your Key Backup recovery key + + Don’t know your Key Backup Passphrase, you can %s. + Key Backup recovery key +