This commit is contained in:
Benoit Marty 2020-05-04 17:30:55 +02:00
parent dc7b3dfc9d
commit d679c9d5d8

View file

@ -70,7 +70,7 @@ class KeysBackupRestoreFromPassphraseFragment @Inject constructor() : VectorBase
mPassphraseInputLayout.error = newValue mPassphraseInputLayout.error = newValue
}) })
helperTextWithLink.text = spannableStringForHelperText(context!!) helperTextWithLink.text = spannableStringForHelperText()
viewModel.showPasswordMode.observe(viewLifecycleOwner, Observer { viewModel.showPasswordMode.observe(viewLifecycleOwner, Observer {
val shouldBeVisible = it ?: false val shouldBeVisible = it ?: false
@ -87,9 +87,9 @@ class KeysBackupRestoreFromPassphraseFragment @Inject constructor() : VectorBase
} }
} }
private fun spannableStringForHelperText(context: Context): SpannableString { private fun spannableStringForHelperText(): SpannableString {
val clickableText = context.getString(R.string.keys_backup_restore_use_recovery_key) val clickableText = getString(R.string.keys_backup_restore_use_recovery_key)
val helperText = context.getString(R.string.keys_backup_restore_with_passphrase_helper_with_link, clickableText) val helperText = getString(R.string.keys_backup_restore_with_passphrase_helper_with_link, clickableText)
val spanString = SpannableString(helperText) val spanString = SpannableString(helperText)
@ -117,7 +117,7 @@ class KeysBackupRestoreFromPassphraseFragment @Inject constructor() : VectorBase
fun onRestoreBackup() { fun onRestoreBackup() {
val value = viewModel.passphrase.value val value = viewModel.passphrase.value
if (value.isNullOrBlank()) { if (value.isNullOrBlank()) {
viewModel.passphraseErrorText.value = context?.getString(R.string.passphrase_empty_error_message) viewModel.passphraseErrorText.value = getString(R.string.passphrase_empty_error_message)
} else { } else {
viewModel.recoverKeys(sharedViewModel) viewModel.recoverKeys(sharedViewModel)
} }