bitwarden-android/src/iOS.Core/Services/DeviceInfoService.cs
Kyle Spearrin 383c683716 update to netstandard2.0 and nuget ref packages
also removed old test projects no longer in use
2017-12-13 16:41:57 -05:00

49 lines
1.4 KiB
C#

using Bit.App.Abstractions;
using Foundation;
using LocalAuthentication;
using UIKit;
namespace Bit.iOS.Core.Services
{
public class DeviceInfoService : IDeviceInfoService
{
public string Model => UIDevice.CurrentDevice.Model;
public int Version
{
get
{
int version;
var versionParts = UIDevice.CurrentDevice.SystemVersion.Split('.');
if(versionParts.Length > 0 && int.TryParse(versionParts[0], out version))
{
return version;
}
// unable to determine version
return -1;
}
}
public float Scale => (float)UIScreen.MainScreen.Scale;
public bool NfcEnabled => false;
public bool HasCamera => true;
public bool AutofillServiceSupported => false;
public bool HasFaceIdSupport
{
get
{
if(Version < 11)
{
return false;
}
var context = new LAContext();
if(!context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out NSError e))
{
return false;
}
return context.BiometryType == LABiometryType.FaceId;
}
}
}
}