mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-29 13:27:46 +00:00
Refactor biometric preference handling (#1374)
Fixes #1371 Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
ae392beaeb
commit
e13a54f212
@ -58,18 +58,13 @@ class GeneralSettings(private val activity: FragmentActivity) : SettingsProvider
|
|||||||
defaultValue = false
|
defaultValue = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val canAuthenticate = BiometricAuthenticator.canAuthenticate(activity)
|
||||||
checkBox(PreferenceKeys.BIOMETRIC_AUTH) {
|
checkBox(PreferenceKeys.BIOMETRIC_AUTH) {
|
||||||
titleRes = R.string.pref_biometric_auth_title
|
titleRes = R.string.pref_biometric_auth_title
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
}
|
enabled = canAuthenticate
|
||||||
.apply {
|
summaryRes =
|
||||||
val canAuthenticate = BiometricAuthenticator.canAuthenticate(activity)
|
if (canAuthenticate) R.string.pref_biometric_auth_summary else R.string.pref_biometric_auth_summary_error
|
||||||
if (!canAuthenticate) {
|
|
||||||
enabled = false
|
|
||||||
checked = false
|
|
||||||
summaryRes = R.string.pref_biometric_auth_summary_error
|
|
||||||
} else {
|
|
||||||
summaryRes = R.string.pref_biometric_auth_summary
|
|
||||||
onClick {
|
onClick {
|
||||||
enabled = false
|
enabled = false
|
||||||
val isChecked = checked
|
val isChecked = checked
|
||||||
@ -103,4 +98,3 @@ class GeneralSettings(private val activity: FragmentActivity) : SettingsProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user