suBiometric: fix open app on second user will auto disable biometric

second user does not support biometric, but the config of app ignores user
This commit is contained in:
vvb2060 2023-07-29 00:49:24 +08:00 committed by John Wu
parent 9571b6f9be
commit ab9ee449e4
2 changed files with 6 additions and 11 deletions

View File

@ -18,14 +18,7 @@ class BiometricHelper(context: Context) {
else -> false else -> false
} }
val isEnabled: Boolean get() { val isEnabled get() = isSupported && Config.suBiometric
val enabled = Config.suBiometric
if (enabled && !isSupported) {
Config.suBiometric = false
return false
}
return enabled
}
fun authenticate( fun authenticate(
activity: FragmentActivity, activity: FragmentActivity,

View File

@ -286,14 +286,16 @@ object Tapjack : BaseSettingsItem.Toggle() {
object Biometrics : BaseSettingsItem.Toggle() { object Biometrics : BaseSettingsItem.Toggle() {
override val title = R.string.settings_su_biometric_title.asText() override val title = R.string.settings_su_biometric_title.asText()
override var description = R.string.settings_su_biometric_summary.asText() override var description = R.string.settings_su_biometric_summary.asText()
override var value by Config::suBiometric override var value
get() = ServiceLocator.biometrics.isEnabled
set(value) {
Config.suBiometric = value
}
override fun refresh() { override fun refresh() {
isEnabled = ServiceLocator.biometrics.isSupported isEnabled = ServiceLocator.biometrics.isSupported
if (!isEnabled) { if (!isEnabled) {
value = false
description = R.string.no_biometric.asText() description = R.string.no_biometric.asText()
notifyPropertyChanged(BR.checked)
} }
} }
} }