From f300d1bafd31f19de77f288605d58aa6c0abb42e Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Fri, 15 Dec 2017 08:20:36 -0800 Subject: [PATCH] Add support for Windows Hello (#212) Windows Hello is currently supported in the UWP app, but all of the strings just point to using fingerprint. Windows Hello instead will adjust based on what the user has avaliable and registered with the Windows OS. To reflect that it isn't just fingerprints update the strings when on UWP. Signed-off-by: Alistair Francis --- src/App/Pages/Lock/LockFingerprintPage.cs | 22 ++++++++++++++---- src/App/Pages/Settings/SettingsPage.cs | 3 ++- src/App/Resources/AppResources.Designer.cs | 27 ++++++++++++++++++++++ src/App/Resources/AppResources.resx | 9 ++++++++ src/UWP.Images/UWP.Images.projitems | 1 + 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/App/Pages/Lock/LockFingerprintPage.cs b/src/App/Pages/Lock/LockFingerprintPage.cs index dbe57b7b0..d29530f3e 100644 --- a/src/App/Pages/Lock/LockFingerprintPage.cs +++ b/src/App/Pages/Lock/LockFingerprintPage.cs @@ -7,6 +7,7 @@ using XLabs.Ioc; using Plugin.Fingerprint.Abstractions; using Plugin.Settings.Abstractions; using Bit.App.Abstractions; +using Bit.App.Utilities; namespace Bit.App.Pages { @@ -32,9 +33,23 @@ namespace Bit.App.Pages public void Init() { + var biometricIcon = Helpers.OnPlatform( + iOS: _deviceInfoService.HasFaceIdSupport ? "smile.png" : "fingerprint.png", + Android: "fingerprint.png", + Windows: "smile.png"); + var biometricText = Helpers.OnPlatform( + iOS: _deviceInfoService.HasFaceIdSupport ? AppResources.UseFaceIDToUnlock : AppResources.UseFingerprintToUnlock, + Android: AppResources.UseFingerprintToUnlock, + Windows: AppResources.UseWindowsHelloToUnlock); + var biometricTitle = Helpers.OnPlatform( + iOS: _deviceInfoService.HasFaceIdSupport ? AppResources.VerifyFaceID : AppResources.VerifyFingerprint, + Android: AppResources.VerifyFingerprint, + Windows: AppResources.VerifyWindowsHello); + + var fingerprintIcon = new ExtendedButton { - Image = _deviceInfoService.HasFaceIdSupport ? "smile.png" : "fingerprint.png", + Image = biometricIcon, BackgroundColor = Color.Transparent, Command = new Command(async () => await CheckFingerprintAsync()), VerticalOptions = LayoutOptions.CenterAndExpand, @@ -43,8 +58,7 @@ namespace Bit.App.Pages var fingerprintButton = new ExtendedButton { - Text = _deviceInfoService.HasFaceIdSupport ? AppResources.UseFaceIDToUnlock : - AppResources.UseFingerprintToUnlock, + Text = biometricText, Command = new Command(async () => await CheckFingerprintAsync()), VerticalOptions = LayoutOptions.EndAndExpand, Style = (Style)Application.Current.Resources["btn-primary"] @@ -67,7 +81,7 @@ namespace Bit.App.Pages Children = { fingerprintIcon, fingerprintButton, logoutButton } }; - Title = _deviceInfoService.HasFaceIdSupport ? AppResources.VerifyFaceID : AppResources.VerifyFingerprint; + Title = biometricTitle; Content = stackLayout; } diff --git a/src/App/Pages/Settings/SettingsPage.cs b/src/App/Pages/Settings/SettingsPage.cs index 81dc93983..f3c17f252 100644 --- a/src/App/Pages/Settings/SettingsPage.cs +++ b/src/App/Pages/Settings/SettingsPage.cs @@ -95,7 +95,8 @@ namespace Bit.App.Pages { var fingerprintName = Helpers.OnPlatform( iOS: _deviceInfoService.HasFaceIdSupport ? AppResources.FaceID : AppResources.TouchID, - Android: AppResources.Fingerprint, Windows: AppResources.Fingerprint); + Android: AppResources.Fingerprint, + Windows: AppResources.WindowsHello); FingerprintCell = new ExtendedSwitchCell { Text = string.Format(AppResources.UnlockWith, fingerprintName), diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 96c9f5bcd..258aa7f3e 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -2949,6 +2949,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Unlock with Windows Hello. + /// + public static string UseWindowsHelloToUnlock { + get { + return ResourceManager.GetString("UseWindowsHelloToUnlock", resourceCulture); + } + } + /// /// Looks up a localized string similar to Validating. /// @@ -3057,6 +3066,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Verify with Windows Hello. + /// + public static string VerifyWindowsHello { + get { + return ResourceManager.GetString("VerifyWindowsHello", resourceCulture); + } + } + /// /// Looks up a localized string similar to Version. /// @@ -3138,6 +3156,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Windows Hello. + /// + public static string WindowsHello { + get { + return ResourceManager.GetString("WindowsHello", resourceCulture); + } + } + /// /// Looks up a localized string similar to Yes. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index c5d45321f..f2f57ab31 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -1231,4 +1231,13 @@ Verify Face ID + + Unlock with Windows Hello + + + Verify with Windows Hello + + + Windows Hello + \ No newline at end of file diff --git a/src/UWP.Images/UWP.Images.projitems b/src/UWP.Images/UWP.Images.projitems index 453ca6721..bcf657558 100644 --- a/src/UWP.Images/UWP.Images.projitems +++ b/src/UWP.Images/UWP.Images.projitems @@ -47,6 +47,7 @@ +