Refactor prompt build code

This commit is contained in:
J-Jamet
2019-10-11 10:41:45 +02:00
parent ee6052f4d1
commit e599a51152

View File

@@ -56,19 +56,29 @@ class BiometricUnlockDatabaseHelper(private val context: FragmentActivity,
private var isBiometricInit = false
private var authenticationCallback: BiometricPrompt.AuthenticationCallback? = null
private val promptInfoStoreCredential = BiometricPrompt.PromptInfo.Builder()
.setTitle(context.getString(R.string.biometric_prompt_store_credential_title))
.setDescription(context.getString(R.string.biometric_prompt_store_credential_message))
//.setDeviceCredentialAllowed(true) TODO device credential
.setNegativeButtonText(context.getString(android.R.string.cancel))
.build()
private val promptInfoStoreCredential = BiometricPrompt.PromptInfo.Builder().apply {
setTitle(context.getString(R.string.biometric_prompt_store_credential_title))
setDescription(context.getString(R.string.biometric_prompt_store_credential_message))
// TODO device credential
/*
if (keyguardManager?.isDeviceSecure == true)
setDeviceCredentialAllowed(true)
else
*/
setNegativeButtonText(context.getString(android.R.string.cancel))
}.build()
private val promptInfoExtractCredential = BiometricPrompt.PromptInfo.Builder()
.setTitle(context.getString(R.string.biometric_prompt_extract_credential_title))
.setDescription(context.getString(R.string.biometric_prompt_extract_credential_message))
//.setDeviceCredentialAllowed(true)
.setNegativeButtonText(context.getString(android.R.string.cancel))
.build()
private val promptInfoExtractCredential = BiometricPrompt.PromptInfo.Builder().apply {
setTitle(context.getString(R.string.biometric_prompt_extract_credential_title))
setDescription(context.getString(R.string.biometric_prompt_extract_credential_message))
// TODO device credential
/*
if (keyguardManager?.isDeviceSecure == true)
setDeviceCredentialAllowed(true)
else
*/
setNegativeButtonText(context.getString(android.R.string.cancel))
}.build()
val isFingerprintInitialized: Boolean
get() {