1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-05 18:13:36 +00:00

support for faceid labels

This commit is contained in:
Kyle Spearrin
2017-11-29 15:47:43 -05:00
parent 898b76a549
commit 14540b4cc0
11 changed files with 79 additions and 6 deletions

View File

@@ -15,6 +15,7 @@ namespace Bit.App.Pages
private readonly IFingerprint _fingerprint;
private readonly ISettings _settings;
private readonly IAppSettingsService _appSettings;
private readonly IDeviceInfoService _deviceInfoService;
private readonly bool _checkFingerprintImmediately;
private DateTime? _lastAction;
@@ -24,6 +25,7 @@ namespace Bit.App.Pages
_fingerprint = Resolver.Resolve<IFingerprint>();
_settings = Resolver.Resolve<ISettings>();
_appSettings = Resolver.Resolve<IAppSettingsService>();
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
Init();
}
@@ -32,7 +34,7 @@ namespace Bit.App.Pages
{
var fingerprintIcon = new ExtendedButton
{
Image = "fingerprint.png",
Image = _deviceInfoService.HasFaceIdSupport ? "smile.png" : "fingerprint.png",
BackgroundColor = Color.Transparent,
Command = new Command(async () => await CheckFingerprintAsync()),
VerticalOptions = LayoutOptions.CenterAndExpand,
@@ -41,7 +43,8 @@ namespace Bit.App.Pages
var fingerprintButton = new ExtendedButton
{
Text = AppResources.UseFingerprintToUnlock,
Text = _deviceInfoService.HasFaceIdSupport ? AppResources.UseFaceIDToUnlock :
AppResources.UseFingerprintToUnlock,
Command = new Command(async () => await CheckFingerprintAsync()),
VerticalOptions = LayoutOptions.EndAndExpand,
Style = (Style)Application.Current.Resources["btn-primary"]
@@ -64,7 +67,7 @@ namespace Bit.App.Pages
Children = { fingerprintIcon, fingerprintButton, logoutButton }
};
Title = AppResources.VerifyFingerprint;
Title = _deviceInfoService.HasFaceIdSupport ? AppResources.VerifyFaceID : AppResources.VerifyFingerprint;
Content = stackLayout;
}

View File

@@ -20,6 +20,7 @@ namespace Bit.App.Pages
private readonly IPushNotificationService _pushNotification;
private readonly IGoogleAnalyticsService _googleAnalyticsService;
private readonly IDeviceActionService _deviceActionService;
private readonly IDeviceInfoService _deviceInfoService;
private readonly ILockService _lockService;
// TODO: Model binding context?
@@ -33,6 +34,7 @@ namespace Bit.App.Pages
_pushNotification = Resolver.Resolve<IPushNotificationService>();
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
_deviceActionService = Resolver.Resolve<IDeviceActionService>();
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
_lockService = Resolver.Resolve<ILockService>();
Init();
@@ -91,8 +93,9 @@ namespace Bit.App.Pages
if((await _fingerprint.GetAvailabilityAsync()) == FingerprintAvailability.Available)
{
var fingerprintName = Helpers.OnPlatform(iOS: AppResources.TouchID, Android: AppResources.Fingerprint,
Windows: AppResources.Fingerprint, WinPhone: AppResources.Fingerprint);
var fingerprintName = Helpers.OnPlatform(
iOS: _deviceInfoService.HasFaceIdSupport ? AppResources.FaceID : AppResources.TouchID,
Android: AppResources.Fingerprint, Windows: AppResources.Fingerprint, WinPhone: AppResources.Fingerprint);
FingerprintCell = new ExtendedSwitchCell
{
Text = string.Format(AppResources.UnlockWith, fingerprintName),