fingerprint phrase and help settings

This commit is contained in:
Kyle Spearrin 2019-05-15 12:54:48 -04:00
parent d4ed276684
commit d6f46cf5c5
4 changed files with 57 additions and 0 deletions

View file

@ -44,6 +44,14 @@ namespace Bit.App.Pages
{
await _vm.AboutAsync();
}
else if(item.Name == AppResources.HelpAndFeedback)
{
_vm.Help();
}
else if(item.Name == AppResources.FingerprintPhrase)
{
await _vm.FingerprintAsync();
}
}
}
}

View file

@ -11,10 +11,14 @@ namespace Bit.App.Pages
public class SettingsPageViewModel : BaseViewModel
{
private readonly IPlatformUtilsService _platformUtilsService;
private readonly ICryptoService _cryptoService;
private readonly IUserService _userService;
public SettingsPageViewModel()
{
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
_userService = ServiceContainer.Resolve<IUserService>("userService");
PageTitle = AppResources.Settings;
BuildList();
@ -35,6 +39,24 @@ namespace Bit.App.Pages
}
}
public void Help()
{
_platformUtilsService.LaunchUri("https://help.bitwarden.com/");
}
public async Task FingerprintAsync()
{
var fingerprint = await _cryptoService.GetFingerprintAsync(await _userService.GetUserIdAsync());
var phrase = string.Join("-", fingerprint);
var text = string.Format("{0}\n\n{1}", AppResources.YourAccountsFingerprint, phrase);
var learnMore = await _platformUtilsService.ShowDialogAsync(text, AppResources.FingerprintPhrase,
AppResources.LearnMore, AppResources.Close);
if(learnMore)
{
_platformUtilsService.LaunchUri("https://help.bitwarden.com/article/fingerprint-phrase/");
}
}
private void BuildList()
{
var doUpper = Device.RuntimePlatform != Device.Android;
@ -54,6 +76,7 @@ namespace Bit.App.Pages
var accountItems = new List<SettingsPageListItem>
{
new SettingsPageListItem { Name = AppResources.ChangeMasterPassword },
new SettingsPageListItem { Name = AppResources.FingerprintPhrase },
new SettingsPageListItem { Name = AppResources.LogOut }
};
var otherItems = new List<SettingsPageListItem>

View file

@ -1617,6 +1617,15 @@ namespace Bit.App.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Fingerprint Phrase.
/// </summary>
public static string FingerprintPhrase {
get {
return ResourceManager.GetString("FingerprintPhrase", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to First Name.
/// </summary>
@ -3813,6 +3822,15 @@ namespace Bit.App.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Your account&apos;s fingerprint phrase.
/// </summary>
public static string YourAccountsFingerprint {
get {
return ResourceManager.GetString("YourAccountsFingerprint", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to To continue, hold your YubiKey NEO against the back of the device or insert your YubiKey into your device&apos;s USB port, then touch its button..
/// </summary>

View file

@ -1467,4 +1467,12 @@
<data name="NoFoldersToList" xml:space="preserve">
<value>There are no folders to list.</value>
</data>
<data name="FingerprintPhrase" xml:space="preserve">
<value>Fingerprint Phrase</value>
<comment>A 'fingerprint phrase' is a unique word phrase (similar to a passphrase) that a user can use to authenticate their public key with another user, for the purposes of sharing.</comment>
</data>
<data name="YourAccountsFingerprint" xml:space="preserve">
<value>Your account's fingerprint phrase</value>
<comment>A 'fingerprint phrase' is a unique word phrase (similar to a passphrase) that a user can use to authenticate their public key with another user, for the purposes of sharing.</comment>
</data>
</root>