1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-24 16:38:22 +01:00

faceid detection

This commit is contained in:
Kyle Spearrin 2019-05-17 09:45:07 -04:00
parent 4aa1209bc7
commit defb67c523
3 changed files with 21 additions and 0 deletions

View File

@ -286,6 +286,11 @@ namespace Bit.Droid.Services
} }
} }
public bool SupportsFaceId()
{
return false;
}
private bool DeleteDir(Java.IO.File dir) private bool DeleteDir(Java.IO.File dir)
{ {
if(dir != null && dir.IsDirectory) if(dir != null && dir.IsDirectory)

View File

@ -17,5 +17,6 @@ namespace Bit.App.Abstractions
Task<string> DisplayPromptAync(string title = null, string description = null, string text = null, Task<string> DisplayPromptAync(string title = null, string description = null, string text = null,
string okButtonText = null, string cancelButtonText = null, bool numericKeyboard = false); string okButtonText = null, string cancelButtonText = null, bool numericKeyboard = false);
void RateApp(); void RateApp();
bool SupportsFaceId();
} }
} }

View File

@ -13,6 +13,7 @@ using Bit.Core.Enums;
using Bit.iOS.Core.Views; using Bit.iOS.Core.Views;
using CoreGraphics; using CoreGraphics;
using Foundation; using Foundation;
using LocalAuthentication;
using MobileCoreServices; using MobileCoreServices;
using Photos; using Photos;
using UIKit; using UIKit;
@ -218,6 +219,20 @@ namespace Bit.iOS.Services
Device.OpenUri(new Uri(uri)); Device.OpenUri(new Uri(uri));
} }
public bool SupportsFaceId()
{
if(SystemMajorVersion() < 11)
{
return false;
}
var context = new LAContext();
if(!context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out NSError e))
{
return false;
}
return context.BiometryType == LABiometryType.FaceId;
}
private void ImagePicker_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e) private void ImagePicker_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e)
{ {
if(sender is UIImagePickerController picker) if(sender is UIImagePickerController picker)