Skip to content

Commit

Permalink
BiometricManager.canAuthenticate() is deprecated
Browse files Browse the repository at this point in the history
Switching to BiometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)
  • Loading branch information
SailReal committed May 2, 2021
1 parent 1eb8c07 commit 3381a12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,9 @@ class VaultListPresenter @Inject constructor( //
}

private fun canUseBiometricOn(vault: VaultModel): Boolean {
return vault.password != null && BiometricManager.from(context()).canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS
return vault.password != null && BiometricManager //
.from(context()) //
.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG) == BiometricManager.BIOMETRIC_SUCCESS
}

fun onAddExistingVault() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class BiometricAuthSettingsActivity : BaseActivity(), //
}

override fun showSetupBiometricAuthDialog() {
val biometricAuthenticationAvailable = BiometricManager.from(context()).canAuthenticate()
val biometricAuthenticationAvailable = BiometricManager //
.from(context()) //
.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)
if (biometricAuthenticationAvailable == BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED) {
showDialog(EnrollSystemBiometricDialog.newInstance())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
private fun activity(): SettingsActivity = this.activity as SettingsActivity

private fun isBiometricAuthenticationNotAvailableRemovePreference() {
val biometricAuthenticationAvailable = BiometricManager.from(requireContext()).canAuthenticate()
val biometricAuthenticationAvailable = BiometricManager //
.from(requireContext()) //
.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)

if (biometricAuthenticationAvailable != BiometricManager.BIOMETRIC_SUCCESS
&& biometricAuthenticationAvailable != BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED) {
Expand Down

0 comments on commit 3381a12

Please sign in to comment.