UseNativeBiometric only for SDK 29

This commit is contained in:
Kyle Spearrin 2019-10-23 11:54:53 -04:00
parent b13f5356fe
commit 9c08a37772

View file

@ -351,17 +351,12 @@ namespace Bit.Droid.Services
public async Task<bool> BiometricAvailableAsync() public async Task<bool> BiometricAvailableAsync()
{ {
var activity = (MainActivity)CrossCurrentActivity.Current.Activity; if(UseNativeBiometric())
if((int)Build.VERSION.SdkInt >= 29)
{ {
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
var manager = activity.GetSystemService(Context.BiometricService) as BiometricManager; var manager = activity.GetSystemService(Context.BiometricService) as BiometricManager;
return manager.CanAuthenticate() == BiometricCode.Success; return manager.CanAuthenticate() == BiometricCode.Success;
} }
else if((int)Build.VERSION.SdkInt == 28)
{
var manager = activity.GetSystemService(Context.FingerprintService) as FingerprintManager;
return manager.IsHardwareDetected && manager.HasEnrolledFingerprints;
}
else else
{ {
try try
@ -377,7 +372,7 @@ namespace Bit.Droid.Services
public bool UseNativeBiometric() public bool UseNativeBiometric()
{ {
return (int)Build.VERSION.SdkInt >= 28; return (int)Build.VERSION.SdkInt >= 29;
} }
public Task<bool> AuthenticateBiometricAsync(string text = null) public Task<bool> AuthenticateBiometricAsync(string text = null)