mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-01 14:55:19 +00:00
chore: touch up codestyle in BiometricAuthenticator.kt
This commit is contained in:
@@ -18,7 +18,7 @@ import logcat.logcat
|
|||||||
object BiometricAuthenticator {
|
object BiometricAuthenticator {
|
||||||
|
|
||||||
private const val TAG = "BiometricAuthenticator"
|
private const val TAG = "BiometricAuthenticator"
|
||||||
private const val validAuthenticators =
|
private const val VALID_AUTHENTICATORS =
|
||||||
Authenticators.DEVICE_CREDENTIAL or Authenticators.BIOMETRIC_WEAK
|
Authenticators.DEVICE_CREDENTIAL or Authenticators.BIOMETRIC_WEAK
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +47,7 @@ object BiometricAuthenticator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun canAuthenticate(activity: FragmentActivity): Boolean {
|
fun canAuthenticate(activity: FragmentActivity): Boolean {
|
||||||
return BiometricManager.from(activity).canAuthenticate(validAuthenticators) ==
|
return BiometricManager.from(activity).canAuthenticate(VALID_AUTHENTICATORS) ==
|
||||||
BiometricManager.BIOMETRIC_SUCCESS
|
BiometricManager.BIOMETRIC_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,9 +88,7 @@ object BiometricAuthenticator {
|
|||||||
Result.Retry
|
Result.Retry
|
||||||
}
|
}
|
||||||
// We cover all guaranteed values above, but [errorCode] is still an Int
|
// We cover all guaranteed values above, but [errorCode] is still an Int
|
||||||
// at the end of
|
// at the end of the day so a catch-all else will always be required.
|
||||||
// the day so a
|
|
||||||
// catch-all else will always be required.
|
|
||||||
else -> {
|
else -> {
|
||||||
Result.Failure(
|
Result.Failure(
|
||||||
errorCode,
|
errorCode,
|
||||||
@@ -118,7 +116,7 @@ object BiometricAuthenticator {
|
|||||||
val promptInfo =
|
val promptInfo =
|
||||||
BiometricPrompt.PromptInfo.Builder()
|
BiometricPrompt.PromptInfo.Builder()
|
||||||
.setTitle(activity.getString(dialogTitleRes))
|
.setTitle(activity.getString(dialogTitleRes))
|
||||||
.setAllowedAuthenticators(validAuthenticators)
|
.setAllowedAuthenticators(VALID_AUTHENTICATORS)
|
||||||
.build()
|
.build()
|
||||||
BiometricPrompt(
|
BiometricPrompt(
|
||||||
activity,
|
activity,
|
||||||
|
Reference in New Issue
Block a user