feat: add custom dialog title for passphrase cache

This commit is contained in:
Harsh Shandilya 2023-06-04 02:02:47 +05:30
parent f6e1830647
commit 469700f627
No known key found for this signature in database
3 changed files with 10 additions and 2 deletions

View file

@ -12,6 +12,7 @@ import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.autofill.AutofillManager import android.view.autofill.AutofillManager
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import app.passwordstore.R
import app.passwordstore.data.crypto.GPGPassphraseCache import app.passwordstore.data.crypto.GPGPassphraseCache
import app.passwordstore.data.passfile.PasswordEntry import app.passwordstore.data.passfile.PasswordEntry
import app.passwordstore.ui.crypto.BasePgpActivity import app.passwordstore.ui.crypto.BasePgpActivity
@ -73,7 +74,10 @@ class AutofillDecryptActivity : BasePgpActivity() {
if ( if (
features.isEnabled(EnableGPGPassphraseCache) && BiometricAuthenticator.canAuthenticate(this) features.isEnabled(EnableGPGPassphraseCache) && BiometricAuthenticator.canAuthenticate(this)
) { ) {
BiometricAuthenticator.authenticate(this) { authResult -> BiometricAuthenticator.authenticate(
this,
R.string.biometric_prompt_title_gpg_passphrase_cache,
) { authResult ->
if (authResult is BiometricAuthenticator.Result.Success) { if (authResult is BiometricAuthenticator.Result.Success) {
lifecycleScope.launch { lifecycleScope.launch {
val cachedPassphrase = val cachedPassphrase =

View file

@ -70,7 +70,10 @@ class DecryptActivity : BasePgpActivity() {
features.isEnabled(EnableGPGPassphraseCache) && features.isEnabled(EnableGPGPassphraseCache) &&
BiometricAuthenticator.canAuthenticate(this@DecryptActivity) BiometricAuthenticator.canAuthenticate(this@DecryptActivity)
) { ) {
BiometricAuthenticator.authenticate(this@DecryptActivity) { authResult -> BiometricAuthenticator.authenticate(
this@DecryptActivity,
R.string.biometric_prompt_title_gpg_passphrase_cache,
) { authResult ->
requireKeysExist { decrypt(isError = false, authResult) } requireKeysExist { decrypt(isError = false, authResult) }
} }
} else { } else {

View file

@ -373,4 +373,5 @@
<string name="pgp_key_manager_no_keys_guidance">Import a key using the add button below</string> <string name="pgp_key_manager_no_keys_guidance">Import a key using the add button below</string>
<string name="no_keys_imported_dialog_title">No keys imported</string> <string name="no_keys_imported_dialog_title">No keys imported</string>
<string name="no_keys_imported_dialog_message">There are no PGP keys imported in the app yet, press the button below to pick a key file</string> <string name="no_keys_imported_dialog_message">There are no PGP keys imported in the app yet, press the button below to pick a key file</string>
<string name="biometric_prompt_title_gpg_passphrase_cache">Unlock passphrase cache</string>
</resources> </resources>