fix: re-enable biometric lock feature

Fixes #2802
This commit is contained in:
Harsh Shandilya 2024-07-30 17:19:44 +05:30
parent f1cb72a1f6
commit 81be3988c8
2 changed files with 10 additions and 6 deletions

View file

@ -6,6 +6,7 @@
package app.passwordstore.ui.settings package app.passwordstore.ui.settings
import android.content.pm.ShortcutManager import android.content.pm.ShortcutManager
import android.os.Build
import androidx.core.content.edit import androidx.core.content.edit
import androidx.core.content.getSystemService import androidx.core.content.getSystemService
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
@ -65,15 +66,17 @@ class GeneralSettings(private val activity: FragmentActivity) : SettingsProvider
defaultValue = false defaultValue = false
} }
// val canAuthenticate = BiometricAuthenticator.canAuthenticate(activity) // See https://github.com/android-password-store/Android-Password-Store/issues/2802
val disableAuth = Build.VERSION.SDK_INT == Build.VERSION_CODES.UPSIDE_DOWN_CAKE
val canAuthenticate = BiometricAuthenticator.canAuthenticate(activity)
switch(PreferenceKeys.BIOMETRIC_AUTH_2) { switch(PreferenceKeys.BIOMETRIC_AUTH_2) {
titleRes = R.string.pref_biometric_auth_title titleRes = R.string.pref_biometric_auth_title
defaultValue = false defaultValue = false
enabled = false enabled = !disableAuth
// summaryRes = summaryRes =
// if (canAuthenticate) R.string.pref_biometric_auth_summary if (disableAuth) R.string.pref_biometric_auth_summary_disabled_platform
// else R.string.pref_biometric_auth_summary_error else if (canAuthenticate) R.string.pref_biometric_auth_summary
summary = "Temporarily disabled due to a bug, see issue 2802" else R.string.pref_biometric_auth_summary_error
onClick { onClick {
enabled = false enabled = false
val isChecked = checked val isChecked = checked

View file

@ -256,6 +256,7 @@
<string name="pref_biometric_auth_title">Enable biometric authentication</string> <string name="pref_biometric_auth_title">Enable biometric authentication</string>
<string name="pref_biometric_auth_summary">When enabled, Password Store will prompt you for your fingerprint when launching the app</string> <string name="pref_biometric_auth_summary">When enabled, Password Store will prompt you for your fingerprint when launching the app</string>
<string name="pref_biometric_auth_summary_error">Fingerprint hardware not accessible or missing</string> <string name="pref_biometric_auth_summary_error">Fingerprint hardware not accessible or missing</string>
<string name="pref_biometric_auth_summary_disabled_platform">Feature unavailable due to a platform bug</string>
<string name="pref_title_openkeystore_clear_keyid">Clear remembered OpenKeystore SSH Key ID</string> <string name="pref_title_openkeystore_clear_keyid">Clear remembered OpenKeystore SSH Key ID</string>
<string name="your_public_key">Your public key</string> <string name="your_public_key">Your public key</string>
<string name="error_generate_ssh_key">Error while trying to generate the ssh-key</string> <string name="error_generate_ssh_key">Error while trying to generate the ssh-key</string>