mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
various settings
This commit is contained in:
parent
264028b623
commit
547cd4e828
4 changed files with 124 additions and 0 deletions
|
@ -56,6 +56,34 @@ namespace Bit.App.Pages
|
|||
{
|
||||
_vm.Rate();
|
||||
}
|
||||
else if(item.Name == AppResources.ImportItems)
|
||||
{
|
||||
_vm.Import();
|
||||
}
|
||||
else if(item.Name == AppResources.ExportVault)
|
||||
{
|
||||
_vm.Export();
|
||||
}
|
||||
else if(item.Name == AppResources.ShareVault)
|
||||
{
|
||||
await _vm.ShareAsync();
|
||||
}
|
||||
else if(item.Name == AppResources.WebVault)
|
||||
{
|
||||
_vm.WebVault();
|
||||
}
|
||||
else if(item.Name == AppResources.ChangeMasterPassword)
|
||||
{
|
||||
await _vm.ChangePasswordAsync();
|
||||
}
|
||||
else if(item.Name == AppResources.TwoStepLogin)
|
||||
{
|
||||
await _vm.TwoStepAsync();
|
||||
}
|
||||
else if(item.Name == AppResources.LogOut)
|
||||
{
|
||||
await _vm.LogOutAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace Bit.App.Pages
|
|||
private readonly ICryptoService _cryptoService;
|
||||
private readonly IUserService _userService;
|
||||
private readonly IDeviceActionService _deviceActionService;
|
||||
private readonly IEnvironmentService _environmentService;
|
||||
private readonly IMessagingService _messagingService;
|
||||
|
||||
public SettingsPageViewModel()
|
||||
{
|
||||
|
@ -22,6 +24,8 @@ namespace Bit.App.Pages
|
|||
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
|
||||
_userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
||||
_environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
||||
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
||||
|
||||
PageTitle = AppResources.Settings;
|
||||
BuildList();
|
||||
|
@ -65,6 +69,66 @@ namespace Bit.App.Pages
|
|||
_deviceActionService.RateApp();
|
||||
}
|
||||
|
||||
public void Import()
|
||||
{
|
||||
_platformUtilsService.LaunchUri("https://help.bitwarden.com/article/import-data/");
|
||||
}
|
||||
|
||||
public void Export()
|
||||
{
|
||||
_platformUtilsService.LaunchUri("https://help.bitwarden.com/article/export-your-data/");
|
||||
}
|
||||
|
||||
public void WebVault()
|
||||
{
|
||||
var url = _environmentService.GetWebVaultUrl();
|
||||
if(url == null)
|
||||
{
|
||||
url = "https://vault.bitwarden.com";
|
||||
}
|
||||
_platformUtilsService.LaunchUri(url);
|
||||
}
|
||||
|
||||
public async Task ShareAsync()
|
||||
{
|
||||
var confirmed = await _platformUtilsService.ShowDialogAsync(AppResources.ShareVaultConfirmation,
|
||||
AppResources.ShareVault, AppResources.Yes, AppResources.Cancel);
|
||||
if(confirmed)
|
||||
{
|
||||
_platformUtilsService.LaunchUri("https://help.bitwarden.com/article/what-is-an-organization/");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task TwoStepAsync()
|
||||
{
|
||||
var confirmed = await _platformUtilsService.ShowDialogAsync(AppResources.TwoStepLoginConfirmation,
|
||||
AppResources.TwoStepLogin, AppResources.Yes, AppResources.Cancel);
|
||||
if(confirmed)
|
||||
{
|
||||
_platformUtilsService.LaunchUri("https://help.bitwarden.com/article/setup-two-step-login/");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ChangePasswordAsync()
|
||||
{
|
||||
var confirmed = await _platformUtilsService.ShowDialogAsync(AppResources.ChangePasswordConfirmation,
|
||||
AppResources.ChangeMasterPassword, AppResources.Yes, AppResources.Cancel);
|
||||
if(confirmed)
|
||||
{
|
||||
_platformUtilsService.LaunchUri("https://help.bitwarden.com/article/change-your-master-password/");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LogOutAsync()
|
||||
{
|
||||
var confirmed = await _platformUtilsService.ShowDialogAsync(AppResources.LogoutConfirmation,
|
||||
AppResources.LogOut, AppResources.Yes, AppResources.Cancel);
|
||||
if(confirmed)
|
||||
{
|
||||
_messagingService.Send("logout");
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildList()
|
||||
{
|
||||
var doUpper = Device.RuntimePlatform != Device.Android;
|
||||
|
@ -87,6 +151,13 @@ namespace Bit.App.Pages
|
|||
new SettingsPageListItem { Name = AppResources.FingerprintPhrase },
|
||||
new SettingsPageListItem { Name = AppResources.LogOut }
|
||||
};
|
||||
var toolsItems = new List<SettingsPageListItem>
|
||||
{
|
||||
new SettingsPageListItem { Name = AppResources.ImportItems },
|
||||
new SettingsPageListItem { Name = AppResources.ExportVault },
|
||||
new SettingsPageListItem { Name = AppResources.ShareVault },
|
||||
new SettingsPageListItem { Name = AppResources.WebVault }
|
||||
};
|
||||
var otherItems = new List<SettingsPageListItem>
|
||||
{
|
||||
new SettingsPageListItem { Name = AppResources.Options },
|
||||
|
@ -99,6 +170,7 @@ namespace Bit.App.Pages
|
|||
new SettingsPageListGroup(manageItems, AppResources.Manage, doUpper),
|
||||
new SettingsPageListGroup(securityItems, AppResources.Security, doUpper),
|
||||
new SettingsPageListGroup(accountItems, AppResources.Account, doUpper),
|
||||
new SettingsPageListGroup(toolsItems, AppResources.Tools, doUpper),
|
||||
new SettingsPageListGroup(otherItems, AppResources.Other, doUpper)
|
||||
};
|
||||
}
|
||||
|
|
18
src/App/Resources/AppResources.Designer.cs
generated
18
src/App/Resources/AppResources.Designer.cs
generated
|
@ -1383,6 +1383,15 @@ namespace Bit.App.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Export Vault.
|
||||
/// </summary>
|
||||
public static string ExportVault {
|
||||
get {
|
||||
return ResourceManager.GetString("ExportVault", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Extension Activated!.
|
||||
/// </summary>
|
||||
|
@ -3192,6 +3201,15 @@ namespace Bit.App.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bitwarden allows you to share your vault with others by using an organization account. Would you like to visit the bitwarden.com website to learn more?.
|
||||
/// </summary>
|
||||
public static string ShareVaultConfirmation {
|
||||
get {
|
||||
return ResourceManager.GetString("ShareVaultConfirmation", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Create an organization to securely share your items with other users..
|
||||
/// </summary>
|
||||
|
|
|
@ -1475,4 +1475,10 @@
|
|||
<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>
|
||||
<data name="ShareVaultConfirmation" xml:space="preserve">
|
||||
<value>Bitwarden allows you to share your vault with others by using an organization account. Would you like to visit the bitwarden.com website to learn more?</value>
|
||||
</data>
|
||||
<data name="ExportVault" xml:space="preserve">
|
||||
<value>Export Vault</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue