aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-04-24 15:00:33 +0530
committerGitHub <noreply@github.com>2020-04-24 15:00:33 +0530
commit73695e2493af46c2375bb7678cb879d33a8aed4f (patch)
tree218cdd48c75e64bd7945b46622ef15ea161d72c0 /app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
parentbee20ac44a6b03082ee85cb52db4d8f32e2dd899 (diff)
downloadHardenedPass-73695e2493af46c2375bb7678cb879d33a8aed4f.tar.gz
HardenedPass-73695e2493af46c2375bb7678cb879d33a8aed4f.zip
auth: redo implementation with a cleaner and simpler API surface (#741)
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/UserPreference.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.kt9
1 files changed, 4 insertions, 5 deletions
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<ShortcutManager>()?.apply {
removeDynamicShortcuts(dynamicShortcuts.map { it.id }.toMutableList())