From b448cad4de67453c8007369ca40e25b2f4727ddb Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 29 Nov 2017 16:05:50 -0500 Subject: [PATCH] faceid support on extension lock page --- src/iOS.Extension/LockFingerprintViewController.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/iOS.Extension/LockFingerprintViewController.cs b/src/iOS.Extension/LockFingerprintViewController.cs index 424fda55b..19614d9a1 100644 --- a/src/iOS.Extension/LockFingerprintViewController.cs +++ b/src/iOS.Extension/LockFingerprintViewController.cs @@ -14,6 +14,7 @@ namespace Bit.iOS.Extension { private IAppSettingsService _appSettingsService; private IFingerprint _fingerprint; + private IDeviceInfoService _deviceInfo; public LockFingerprintViewController(IntPtr handle) : base(handle) { } @@ -32,18 +33,23 @@ namespace Bit.iOS.Extension { _appSettingsService = Resolver.Resolve(); _fingerprint = Resolver.Resolve(); + _deviceInfo = Resolver.Resolve(); - NavItem.Title = AppResources.VerifyFingerprint; + NavItem.Title = _deviceInfo.HasFaceIdSupport ? AppResources.VerifyFaceID : AppResources.VerifyFingerprint; CancelButton.Title = AppResources.Cancel; View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); - UseButton.SetTitle(AppResources.UseFingerprintToUnlock, UIControlState.Normal); + UseButton.SetTitle(_deviceInfo.HasFaceIdSupport ? AppResources.UseFaceIDToUnlock : + AppResources.UseFingerprintToUnlock, UIControlState.Normal); var descriptor = UIFontDescriptor.PreferredBody; UseButton.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize); UseButton.BackgroundColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f); UseButton.TintColor = UIColor.White; UseButton.TouchUpInside += UseButton_TouchUpInside; + FingerprintButton.SetImage(new UIImage(_deviceInfo.HasFaceIdSupport ? "smile.png" : "fingerprint.png"), + UIControlState.Normal); + base.ViewDidLoad(); } @@ -70,7 +76,8 @@ namespace Bit.iOS.Extension public async Task CheckFingerprintAsync() { - var fingerprintRequest = new AuthenticationRequestConfiguration(AppResources.FingerprintDirection) + var fingerprintRequest = new AuthenticationRequestConfiguration( + _deviceInfo.HasFaceIdSupport ? AppResources.FaceIDDirection : AppResources.FingerprintDirection) { AllowAlternativeAuthentication = true, CancelTitle = AppResources.Cancel,