fix: temporarily disable pre-launch biometric auth (#2803)

* fix: temporarily disable pre-launch biometric auth

Completely broken right now and prevents users from opening the app.

Updates #2802

* fix: disable UnusedResources lint
This commit is contained in:
Harsh Shandilya 2023-12-10 22:55:25 +05:30 committed by GitHub
parent d00626d5d3
commit a04d6fa9f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 10 deletions

View file

@ -25,14 +25,14 @@ class LaunchActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val prefs = sharedPrefs val prefs = sharedPrefs
if (prefs.getBoolean(PreferenceKeys.BIOMETRIC_AUTH, false)) { if (prefs.getBoolean(PreferenceKeys.BIOMETRIC_AUTH_2, false)) {
BiometricAuthenticator.authenticate(this) { result -> BiometricAuthenticator.authenticate(this) { result ->
when (result) { when (result) {
is Result.Success -> { is Result.Success -> {
startTargetActivity(false) startTargetActivity(false)
} }
is Result.HardwareUnavailableOrDisabled -> { is Result.HardwareUnavailableOrDisabled -> {
prefs.edit { remove(PreferenceKeys.BIOMETRIC_AUTH) } prefs.edit { remove(PreferenceKeys.BIOMETRIC_AUTH_2) }
startTargetActivity(false) startTargetActivity(false)
} }
is Result.Failure, is Result.Failure,

View file

@ -65,14 +65,15 @@ class GeneralSettings(private val activity: FragmentActivity) : SettingsProvider
defaultValue = false defaultValue = false
} }
val canAuthenticate = BiometricAuthenticator.canAuthenticate(activity) // val canAuthenticate = BiometricAuthenticator.canAuthenticate(activity)
switch(PreferenceKeys.BIOMETRIC_AUTH) { switch(PreferenceKeys.BIOMETRIC_AUTH_2) {
titleRes = R.string.pref_biometric_auth_title titleRes = R.string.pref_biometric_auth_title
defaultValue = false defaultValue = false
enabled = canAuthenticate enabled = false
summaryRes = // summaryRes =
if (canAuthenticate) R.string.pref_biometric_auth_summary // if (canAuthenticate) R.string.pref_biometric_auth_summary
else R.string.pref_biometric_auth_summary_error // else R.string.pref_biometric_auth_summary_error
summary = "Temporarily disabled due to a bug, see issue 2802"
onClick { onClick {
enabled = false enabled = false
val isChecked = checked val isChecked = checked
@ -81,7 +82,7 @@ class GeneralSettings(private val activity: FragmentActivity) : SettingsProvider
when (result) { when (result) {
is Result.Success -> { is Result.Success -> {
// Apply the changes // Apply the changes
putBoolean(PreferenceKeys.BIOMETRIC_AUTH, checked) putBoolean(PreferenceKeys.BIOMETRIC_AUTH_2, checked)
enabled = true enabled = true
} }
is Result.Retry -> {} is Result.Retry -> {}
@ -89,7 +90,7 @@ class GeneralSettings(private val activity: FragmentActivity) : SettingsProvider
// If any error occurs, revert back to the previous // If any error occurs, revert back to the previous
// state. This // state. This
// catch-all clause includes the cancellation case. // catch-all clause includes the cancellation case.
putBoolean(PreferenceKeys.BIOMETRIC_AUTH, !checked) putBoolean(PreferenceKeys.BIOMETRIC_AUTH_2, !checked)
checked = !isChecked checked = !isChecked
enabled = true enabled = true
} }

View file

@ -10,6 +10,7 @@ object PreferenceKeys {
const val APP_THEME = "app_theme" const val APP_THEME = "app_theme"
const val AUTOFILL_ENABLE = "autofill_enable" const val AUTOFILL_ENABLE = "autofill_enable"
const val BIOMETRIC_AUTH = "biometric_auth" const val BIOMETRIC_AUTH = "biometric_auth"
const val BIOMETRIC_AUTH_2 = "biometric_auth_delete_soon_please"
@Deprecated( @Deprecated(
message = "Use CLEAR_CLIPBOARD_HISTORY instead", message = "Use CLEAR_CLIPBOARD_HISTORY instead",
replaceWith = ReplaceWith("PreferenceKeys.CLEAR_CLIPBOARD_HISTORY"), replaceWith = ReplaceWith("PreferenceKeys.CLEAR_CLIPBOARD_HISTORY"),

View file

@ -40,6 +40,8 @@ object LintConfig {
disable += "FragmentFieldInjection" disable += "FragmentFieldInjection"
// Too pedantic // Too pedantic
disable += "ArgInFormattedQuantityStringRes" disable += "ArgInFormattedQuantityStringRes"
// Biometric strings are temporarily unused due to issue 2802
disable += "UnusedResources"
} }
baseline = project.file("lint-baseline.xml") baseline = project.file("lint-baseline.xml")
} }