mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 07:43:37 +00:00
use native biomatrics on Android
This commit is contained in:
@@ -15,6 +15,7 @@ using Foundation;
|
||||
using LocalAuthentication;
|
||||
using MobileCoreServices;
|
||||
using Photos;
|
||||
using Plugin.Fingerprint;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
|
||||
@@ -243,18 +244,47 @@ namespace Bit.iOS.Core.Services
|
||||
Device.OpenUri(new Uri(uri));
|
||||
}
|
||||
|
||||
public bool SupportsFaceId()
|
||||
public bool SupportsFaceBiometric()
|
||||
{
|
||||
if(SystemMajorVersion() < 11)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var context = new LAContext();
|
||||
if(!context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out NSError e))
|
||||
using(var context = new LAContext())
|
||||
{
|
||||
if(!context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out var e))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return context.BiometryType == LABiometryType.FaceId;
|
||||
}
|
||||
}
|
||||
|
||||
public Task<bool> SupportsFaceBiometricAsync()
|
||||
{
|
||||
return Task.FromResult(SupportsFaceBiometric());
|
||||
}
|
||||
|
||||
public async Task<bool> BiometricAvailableAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
return await CrossFingerprint.Current.IsAvailableAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return context.BiometryType == LABiometryType.FaceId;
|
||||
}
|
||||
|
||||
public bool UseNativeBiometric()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public Task<bool> AuthenticateBiometricAsync(string text = null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public bool SupportsNfc()
|
||||
|
||||
Reference in New Issue
Block a user