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 <alistair@alistair23.me>
This commit is contained in:
Alistair Francis 2017-12-15 08:20:36 -08:00 committed by Kyle Spearrin
parent d395115cc9
commit f300d1bafd
5 changed files with 57 additions and 5 deletions

View file

@ -7,6 +7,7 @@ using XLabs.Ioc;
using Plugin.Fingerprint.Abstractions; using Plugin.Fingerprint.Abstractions;
using Plugin.Settings.Abstractions; using Plugin.Settings.Abstractions;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Bit.App.Utilities;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@ -32,9 +33,23 @@ namespace Bit.App.Pages
public void Init() 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 var fingerprintIcon = new ExtendedButton
{ {
Image = _deviceInfoService.HasFaceIdSupport ? "smile.png" : "fingerprint.png", Image = biometricIcon,
BackgroundColor = Color.Transparent, BackgroundColor = Color.Transparent,
Command = new Command(async () => await CheckFingerprintAsync()), Command = new Command(async () => await CheckFingerprintAsync()),
VerticalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand,
@ -43,8 +58,7 @@ namespace Bit.App.Pages
var fingerprintButton = new ExtendedButton var fingerprintButton = new ExtendedButton
{ {
Text = _deviceInfoService.HasFaceIdSupport ? AppResources.UseFaceIDToUnlock : Text = biometricText,
AppResources.UseFingerprintToUnlock,
Command = new Command(async () => await CheckFingerprintAsync()), Command = new Command(async () => await CheckFingerprintAsync()),
VerticalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.EndAndExpand,
Style = (Style)Application.Current.Resources["btn-primary"] Style = (Style)Application.Current.Resources["btn-primary"]
@ -67,7 +81,7 @@ namespace Bit.App.Pages
Children = { fingerprintIcon, fingerprintButton, logoutButton } Children = { fingerprintIcon, fingerprintButton, logoutButton }
}; };
Title = _deviceInfoService.HasFaceIdSupport ? AppResources.VerifyFaceID : AppResources.VerifyFingerprint; Title = biometricTitle;
Content = stackLayout; Content = stackLayout;
} }

View file

@ -95,7 +95,8 @@ namespace Bit.App.Pages
{ {
var fingerprintName = Helpers.OnPlatform( var fingerprintName = Helpers.OnPlatform(
iOS: _deviceInfoService.HasFaceIdSupport ? AppResources.FaceID : AppResources.TouchID, iOS: _deviceInfoService.HasFaceIdSupport ? AppResources.FaceID : AppResources.TouchID,
Android: AppResources.Fingerprint, Windows: AppResources.Fingerprint); Android: AppResources.Fingerprint,
Windows: AppResources.WindowsHello);
FingerprintCell = new ExtendedSwitchCell FingerprintCell = new ExtendedSwitchCell
{ {
Text = string.Format(AppResources.UnlockWith, fingerprintName), Text = string.Format(AppResources.UnlockWith, fingerprintName),

View file

@ -2949,6 +2949,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Unlock with Windows Hello.
/// </summary>
public static string UseWindowsHelloToUnlock {
get {
return ResourceManager.GetString("UseWindowsHelloToUnlock", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Validating. /// Looks up a localized string similar to Validating.
/// </summary> /// </summary>
@ -3057,6 +3066,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Verify with Windows Hello.
/// </summary>
public static string VerifyWindowsHello {
get {
return ResourceManager.GetString("VerifyWindowsHello", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Version. /// Looks up a localized string similar to Version.
/// </summary> /// </summary>
@ -3138,6 +3156,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Windows Hello.
/// </summary>
public static string WindowsHello {
get {
return ResourceManager.GetString("WindowsHello", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Yes. /// Looks up a localized string similar to Yes.
/// </summary> /// </summary>

View file

@ -1231,4 +1231,13 @@
<data name="VerifyFaceID" xml:space="preserve"> <data name="VerifyFaceID" xml:space="preserve">
<value>Verify Face ID</value> <value>Verify Face ID</value>
</data> </data>
<data name="UseWindowsHelloToUnlock" xml:space="preserve">
<value>Unlock with Windows Hello</value>
</data>
<data name="VerifyWindowsHello" xml:space="preserve">
<value>Verify with Windows Hello</value>
</data>
<data name="WindowsHello" xml:space="preserve">
<value>Windows Hello</value>
</data>
</root> </root>

View file

@ -47,6 +47,7 @@
<Content Include="$(MSBuildThisFileDirectory)search.png" /> <Content Include="$(MSBuildThisFileDirectory)search.png" />
<Content Include="$(MSBuildThisFileDirectory)share.png" /> <Content Include="$(MSBuildThisFileDirectory)share.png" />
<Content Include="$(MSBuildThisFileDirectory)share_tools.png" /> <Content Include="$(MSBuildThisFileDirectory)share_tools.png" />
<Content Include="$(MSBuildThisFileDirectory)smile.png" />
<Content Include="$(MSBuildThisFileDirectory)star.png" /> <Content Include="$(MSBuildThisFileDirectory)star.png" />
<Content Include="$(MSBuildThisFileDirectory)star_selected.png" /> <Content Include="$(MSBuildThisFileDirectory)star_selected.png" />
<Content Include="$(MSBuildThisFileDirectory)tools.png" /> <Content Include="$(MSBuildThisFileDirectory)tools.png" />