From f951fea555410c899d86bc64bbc348cb30866239 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 23 Oct 2019 09:24:34 -0400 Subject: [PATCH] use bio strings for native android bio --- src/Android/Services/DeviceActionService.cs | 2 +- src/App/Pages/Accounts/LockPageViewModel.cs | 14 ++++++++++-- .../SettingsPage/SettingsPage.xaml.cs | 4 ++++ .../SettingsPage/SettingsPageViewModel.cs | 4 ++++ src/App/Resources/AppResources.Designer.cs | 22 +++++++++++++++++-- src/App/Resources/AppResources.resx | 8 ++++++- 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/Android/Services/DeviceActionService.cs b/src/Android/Services/DeviceActionService.cs index 5e6932b4d..b9ee1ca07 100644 --- a/src/Android/Services/DeviceActionService.cs +++ b/src/Android/Services/DeviceActionService.cs @@ -378,7 +378,7 @@ namespace Bit.Droid.Services { if(string.IsNullOrWhiteSpace(text)) { - text = AppResources.BiometricDirection; + text = AppResources.BiometricsDirection; } var activity = (MainActivity)CrossCurrentActivity.Current.Activity; diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index 4b3d3a78d..c92b8b336 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -127,8 +127,18 @@ namespace Bit.App.Pages if(FingerprintLock) { var supportsFace = await _deviceActionService.SupportsFaceBiometricAsync(); - FingerprintButtonText = supportsFace ? AppResources.UseFaceIDToUnlock : - AppResources.UseFingerprintToUnlock; + if(Device.RuntimePlatform == Device.iOS && supportsFace) + { + FingerprintButtonText = AppResources.UseFaceIDToUnlock; + } + else if(Device.RuntimePlatform == Device.Android && _deviceActionService.UseNativeBiometric()) + { + FingerprintButtonText = AppResources.UseBiometricsToUnlock; + } + else + { + FingerprintButtonText = AppResources.UseFingerprintToUnlock; + } if(autoPromptFingerprint) { var tasks = Task.Run(async () => diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs index 4d6beb41d..0a5a2a58c 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs @@ -145,6 +145,10 @@ namespace Bit.App.Pages var supportsFace = await _deviceActionService.SupportsFaceBiometricAsync(); fingerprintName = supportsFace ? AppResources.FaceID : AppResources.TouchID; } + else if(Device.RuntimePlatform == Device.Android && _deviceActionService.UseNativeBiometric()) + { + fingerprintName = AppResources.Biometrics; + } if(item.Name == string.Format(AppResources.UnlockWith, fingerprintName)) { await _vm.UpdateFingerprintAsync(); diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs index 9202c54cb..e6b3d7de1 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs @@ -331,6 +331,10 @@ namespace Bit.App.Pages fingerprintName = _deviceActionService.SupportsFaceBiometric() ? AppResources.FaceID : AppResources.TouchID; } + else if(Device.RuntimePlatform == Device.Android && _deviceActionService.UseNativeBiometric()) + { + fingerprintName = AppResources.Biometrics; + } var item = new SettingsPageListItem { Name = string.Format(AppResources.UnlockWith, fingerprintName), diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 6fb3e6d44..78a18939f 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -537,12 +537,21 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Biometrics. + /// + public static string Biometrics { + get { + return ResourceManager.GetString("Biometrics", resourceCulture); + } + } + /// /// Looks up a localized string similar to Use biometrics to verify.. /// - public static string BiometricDirection { + public static string BiometricsDirection { get { - return ResourceManager.GetString("BiometricDirection", resourceCulture); + return ResourceManager.GetString("BiometricsDirection", resourceCulture); } } @@ -3831,6 +3840,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Use Biometrics To Unlock. + /// + public static string UseBiometricsToUnlock { + get { + return ResourceManager.GetString("UseBiometricsToUnlock", resourceCulture); + } + } + /// /// Looks up a localized string similar to Use Face ID To Unlock. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 9b683e584..25a9a9478 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -1578,7 +1578,13 @@ Your login session has expired. - + Use biometrics to verify. + + Biometrics + + + Use Biometrics To Unlock + \ No newline at end of file