From 73695e2493af46c2375bb7678cb879d33a8aed4f Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 24 Apr 2020 15:00:33 +0530 Subject: auth: redo implementation with a cleaner and simpler API surface (#741) --- app/src/main/java/com/zeapo/pwdstore/UserPreference.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'app/src/main/java/com/zeapo/pwdstore/UserPreference.kt') diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt index 32d1e87a..a9629c6c 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt @@ -46,9 +46,8 @@ import com.zeapo.pwdstore.git.GitServerConfigActivity import com.zeapo.pwdstore.pwgenxkpwd.XkpwdDictionary import com.zeapo.pwdstore.sshkeygen.ShowSshKeyFragment import com.zeapo.pwdstore.sshkeygen.SshKeyGenActivity +import com.zeapo.pwdstore.utils.BiometricAuthenticator import com.zeapo.pwdstore.utils.PasswordRepository -import com.zeapo.pwdstore.utils.auth.AuthenticationResult -import com.zeapo.pwdstore.utils.auth.Authenticator import com.zeapo.pwdstore.utils.autofillManager import com.zeapo.pwdstore.utils.getEncryptedPrefs import java.io.File @@ -297,9 +296,9 @@ class UserPreference : AppCompatActivity() { isEnabled = false sharedPreferences.edit { val checked = isChecked - Authenticator(requireActivity()) { result -> + BiometricAuthenticator.authenticate(requireActivity()) { result -> when (result) { - is AuthenticationResult.Success -> { + is BiometricAuthenticator.Result.Success -> { // Apply the changes putBoolean("biometric_auth", checked) isEnabled = true @@ -312,7 +311,7 @@ class UserPreference : AppCompatActivity() { isEnabled = true } } - }.authenticate() + } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { requireContext().getSystemService()?.apply { removeDynamicShortcuts(dynamicShortcuts.map { it.id }.toMutableList()) -- cgit v1.2.3