From ab9ee449e4d499943391be0631cc01201be6f533 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Sat, 29 Jul 2023 00:49:24 +0800 Subject: [PATCH] suBiometric: fix open app on second user will auto disable biometric second user does not support biometric, but the config of app ignores user --- .../com/topjohnwu/magisk/core/utils/BiometricHelper.kt | 9 +-------- .../com/topjohnwu/magisk/ui/settings/SettingsItems.kt | 8 +++++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/BiometricHelper.kt b/app/src/main/java/com/topjohnwu/magisk/core/utils/BiometricHelper.kt index 52ccb6a99..6cdfa6cf5 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/utils/BiometricHelper.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/utils/BiometricHelper.kt @@ -18,14 +18,7 @@ class BiometricHelper(context: Context) { else -> false } - val isEnabled: Boolean get() { - val enabled = Config.suBiometric - if (enabled && !isSupported) { - Config.suBiometric = false - return false - } - return enabled - } + val isEnabled get() = isSupported && Config.suBiometric fun authenticate( activity: FragmentActivity, diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt index 823f1f19e..06cc6f7a6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt @@ -286,14 +286,16 @@ object Tapjack : BaseSettingsItem.Toggle() { object Biometrics : BaseSettingsItem.Toggle() { override val title = R.string.settings_su_biometric_title.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() { isEnabled = ServiceLocator.biometrics.isSupported if (!isEnabled) { - value = false description = R.string.no_biometric.asText() - notifyPropertyChanged(BR.checked) } } }