mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-23 11:45:38 +01:00
default to "My Vault" option
This commit is contained in:
parent
3f99c513f3
commit
b07dc8443e
@ -4,6 +4,7 @@ namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface IAppSettingsService
|
||||
{
|
||||
bool DefaultPageVault { get; set; }
|
||||
bool Locked { get; set; }
|
||||
DateTime LastActivity { get; set; }
|
||||
DateTime LastCacheClear { get; set; }
|
||||
|
@ -13,6 +13,7 @@
|
||||
public const string SettingDisableTotpCopy = "setting:disableAutoCopyTotp";
|
||||
public const string AutofillPersistNotification = "setting:persistNotification";
|
||||
public const string AutofillPasswordField = "setting:autofillPasswordField";
|
||||
public const string SettingDefaultPageVault = "setting:defaultPageVault";
|
||||
|
||||
public const string PasswordGeneratorLength = "pwGenerator:length";
|
||||
public const string PasswordGeneratorUppercase = "pwGenerator:uppercase";
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using Bit.App.Controls;
|
||||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using Bit.App.Abstractions;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
@ -25,7 +27,7 @@ namespace Bit.App.Pages
|
||||
Children.Add(toolsNavigation);
|
||||
Children.Add(settingsNavigation);
|
||||
|
||||
if(myVault)
|
||||
if(myVault || Resolver.Resolve<IAppSettingsService>().DefaultPageVault)
|
||||
{
|
||||
SelectedItem = vaultNavigation;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ namespace Bit.App.Pages
|
||||
}
|
||||
|
||||
private StackLayout StackLayout { get; set; }
|
||||
private ExtendedSwitchCell DefaultPageVaultCell { get; set; }
|
||||
private Label DefaultPageVaultLabel { get; set; }
|
||||
private ExtendedSwitchCell CopyTotpCell { get; set; }
|
||||
private Label CopyTotpLabel { get; set; }
|
||||
private ExtendedSwitchCell AnalyticsCell { get; set; }
|
||||
@ -40,13 +42,30 @@ namespace Bit.App.Pages
|
||||
|
||||
private void Init()
|
||||
{
|
||||
DefaultPageVaultCell = new ExtendedSwitchCell
|
||||
{
|
||||
Text = AppResources.DefaultPageVault,
|
||||
On = _appSettings.DefaultPageVault
|
||||
};
|
||||
|
||||
var defaultPageVaultTable = new FormTableView(true)
|
||||
{
|
||||
Root = new TableRoot
|
||||
{
|
||||
new TableSection(Helpers.GetEmptyTableSectionTitle())
|
||||
{
|
||||
DefaultPageVaultCell
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WebsiteIconsCell = new ExtendedSwitchCell
|
||||
{
|
||||
Text = AppResources.DisableWebsiteIcons,
|
||||
On = _appSettings.DisableWebsiteIcons
|
||||
};
|
||||
|
||||
var websiteIconsTable = new FormTableView(true)
|
||||
var websiteIconsTable = new FormTableView
|
||||
{
|
||||
Root = new TableRoot
|
||||
{
|
||||
@ -91,6 +110,11 @@ namespace Bit.App.Pages
|
||||
}
|
||||
};
|
||||
|
||||
DefaultPageVaultLabel = new FormTableLabel(this)
|
||||
{
|
||||
Text = AppResources.DefaultPageVaultDescription
|
||||
};
|
||||
|
||||
CopyTotpLabel = new FormTableLabel(this)
|
||||
{
|
||||
Text = AppResources.DisableAutoTotpCopyDescription
|
||||
@ -110,6 +134,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
Children =
|
||||
{
|
||||
defaultPageVaultTable, DefaultPageVaultLabel,
|
||||
websiteIconsTable, WebsiteIconsLabel,
|
||||
totpTable, CopyTotpLabel,
|
||||
analyticsTable, AnalyticsLabel
|
||||
@ -214,6 +239,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
base.OnAppearing();
|
||||
|
||||
DefaultPageVaultCell.OnChanged += DefaultPageVaultCell_Changed;
|
||||
AnalyticsCell.OnChanged += AnalyticsCell_Changed;
|
||||
WebsiteIconsCell.OnChanged += WebsiteIconsCell_Changed;
|
||||
CopyTotpCell.OnChanged += CopyTotpCell_OnChanged;
|
||||
@ -231,6 +257,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
base.OnDisappearing();
|
||||
|
||||
DefaultPageVaultCell.OnChanged -= DefaultPageVaultCell_Changed;
|
||||
AnalyticsCell.OnChanged -= AnalyticsCell_Changed;
|
||||
WebsiteIconsCell.OnChanged -= WebsiteIconsCell_Changed;
|
||||
CopyTotpCell.OnChanged -= CopyTotpCell_OnChanged;
|
||||
@ -246,6 +273,7 @@ namespace Bit.App.Pages
|
||||
|
||||
private void Layout_LayoutChanged(object sender, EventArgs e)
|
||||
{
|
||||
DefaultPageVaultLabel.WidthRequest = StackLayout.Bounds.Width - DefaultPageVaultLabel.Bounds.Left * 2;
|
||||
AnalyticsLabel.WidthRequest = StackLayout.Bounds.Width - AnalyticsLabel.Bounds.Left * 2;
|
||||
WebsiteIconsLabel.WidthRequest = StackLayout.Bounds.Width - WebsiteIconsLabel.Bounds.Left * 2;
|
||||
CopyTotpLabel.WidthRequest = StackLayout.Bounds.Width - CopyTotpLabel.Bounds.Left * 2;
|
||||
@ -267,6 +295,17 @@ namespace Bit.App.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private void DefaultPageVaultCell_Changed(object sender, ToggledEventArgs e)
|
||||
{
|
||||
var cell = sender as ExtendedSwitchCell;
|
||||
if(cell == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_appSettings.DefaultPageVault = cell.On;
|
||||
}
|
||||
|
||||
private void WebsiteIconsCell_Changed(object sender, ToggledEventArgs e)
|
||||
{
|
||||
var cell = sender as ExtendedSwitchCell;
|
||||
|
18
src/App/Resources/AppResources.Designer.cs
generated
18
src/App/Resources/AppResources.Designer.cs
generated
@ -880,6 +880,24 @@ namespace Bit.App.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default To "My Vault".
|
||||
/// </summary>
|
||||
public static string DefaultPageVault {
|
||||
get {
|
||||
return ResourceManager.GetString("DefaultPageVault", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default to the "My Vault" page instead of "Favorites" whenever I open the app..
|
||||
/// </summary>
|
||||
public static string DefaultPageVaultDescription {
|
||||
get {
|
||||
return ResourceManager.GetString("DefaultPageVaultDescription", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete.
|
||||
/// </summary>
|
||||
|
@ -1197,4 +1197,10 @@
|
||||
<data name="Collections" xml:space="preserve">
|
||||
<value>Collections</value>
|
||||
</data>
|
||||
<data name="DefaultPageVault" xml:space="preserve">
|
||||
<value>Default To "My Vault"</value>
|
||||
</data>
|
||||
<data name="DefaultPageVaultDescription" xml:space="preserve">
|
||||
<value>Default to the "My Vault" page instead of "Favorites" whenever I open the app.</value>
|
||||
</data>
|
||||
</root>
|
@ -14,6 +14,18 @@ namespace Bit.App.Services
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
public bool DefaultPageVault
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings.GetValueOrDefault(Constants.SettingDefaultPageVault, false);
|
||||
}
|
||||
set
|
||||
{
|
||||
_settings.AddOrUpdateValue(Constants.SettingDefaultPageVault, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Locked
|
||||
{
|
||||
get
|
||||
|
Loading…
Reference in New Issue
Block a user