mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
default to "My Vault" option
This commit is contained in:
parent
3f99c513f3
commit
b07dc8443e
7 changed files with 81 additions and 2 deletions
|
@ -4,6 +4,7 @@ namespace Bit.App.Abstractions
|
||||||
{
|
{
|
||||||
public interface IAppSettingsService
|
public interface IAppSettingsService
|
||||||
{
|
{
|
||||||
|
bool DefaultPageVault { get; set; }
|
||||||
bool Locked { get; set; }
|
bool Locked { get; set; }
|
||||||
DateTime LastActivity { get; set; }
|
DateTime LastActivity { get; set; }
|
||||||
DateTime LastCacheClear { get; set; }
|
DateTime LastCacheClear { get; set; }
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
public const string SettingDisableTotpCopy = "setting:disableAutoCopyTotp";
|
public const string SettingDisableTotpCopy = "setting:disableAutoCopyTotp";
|
||||||
public const string AutofillPersistNotification = "setting:persistNotification";
|
public const string AutofillPersistNotification = "setting:persistNotification";
|
||||||
public const string AutofillPasswordField = "setting:autofillPasswordField";
|
public const string AutofillPasswordField = "setting:autofillPasswordField";
|
||||||
|
public const string SettingDefaultPageVault = "setting:defaultPageVault";
|
||||||
|
|
||||||
public const string PasswordGeneratorLength = "pwGenerator:length";
|
public const string PasswordGeneratorLength = "pwGenerator:length";
|
||||||
public const string PasswordGeneratorUppercase = "pwGenerator:uppercase";
|
public const string PasswordGeneratorUppercase = "pwGenerator:uppercase";
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using Bit.App.Controls;
|
using Bit.App.Controls;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
using XLabs.Ioc;
|
||||||
|
using Bit.App.Abstractions;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
|
@ -25,7 +27,7 @@ namespace Bit.App.Pages
|
||||||
Children.Add(toolsNavigation);
|
Children.Add(toolsNavigation);
|
||||||
Children.Add(settingsNavigation);
|
Children.Add(settingsNavigation);
|
||||||
|
|
||||||
if(myVault)
|
if(myVault || Resolver.Resolve<IAppSettingsService>().DefaultPageVault)
|
||||||
{
|
{
|
||||||
SelectedItem = vaultNavigation;
|
SelectedItem = vaultNavigation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
|
|
||||||
private StackLayout StackLayout { get; set; }
|
private StackLayout StackLayout { get; set; }
|
||||||
|
private ExtendedSwitchCell DefaultPageVaultCell { get; set; }
|
||||||
|
private Label DefaultPageVaultLabel { get; set; }
|
||||||
private ExtendedSwitchCell CopyTotpCell { get; set; }
|
private ExtendedSwitchCell CopyTotpCell { get; set; }
|
||||||
private Label CopyTotpLabel { get; set; }
|
private Label CopyTotpLabel { get; set; }
|
||||||
private ExtendedSwitchCell AnalyticsCell { get; set; }
|
private ExtendedSwitchCell AnalyticsCell { get; set; }
|
||||||
|
@ -40,13 +42,30 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private void Init()
|
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
|
WebsiteIconsCell = new ExtendedSwitchCell
|
||||||
{
|
{
|
||||||
Text = AppResources.DisableWebsiteIcons,
|
Text = AppResources.DisableWebsiteIcons,
|
||||||
On = _appSettings.DisableWebsiteIcons
|
On = _appSettings.DisableWebsiteIcons
|
||||||
};
|
};
|
||||||
|
|
||||||
var websiteIconsTable = new FormTableView(true)
|
var websiteIconsTable = new FormTableView
|
||||||
{
|
{
|
||||||
Root = new TableRoot
|
Root = new TableRoot
|
||||||
{
|
{
|
||||||
|
@ -91,6 +110,11 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DefaultPageVaultLabel = new FormTableLabel(this)
|
||||||
|
{
|
||||||
|
Text = AppResources.DefaultPageVaultDescription
|
||||||
|
};
|
||||||
|
|
||||||
CopyTotpLabel = new FormTableLabel(this)
|
CopyTotpLabel = new FormTableLabel(this)
|
||||||
{
|
{
|
||||||
Text = AppResources.DisableAutoTotpCopyDescription
|
Text = AppResources.DisableAutoTotpCopyDescription
|
||||||
|
@ -110,6 +134,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
Children =
|
Children =
|
||||||
{
|
{
|
||||||
|
defaultPageVaultTable, DefaultPageVaultLabel,
|
||||||
websiteIconsTable, WebsiteIconsLabel,
|
websiteIconsTable, WebsiteIconsLabel,
|
||||||
totpTable, CopyTotpLabel,
|
totpTable, CopyTotpLabel,
|
||||||
analyticsTable, AnalyticsLabel
|
analyticsTable, AnalyticsLabel
|
||||||
|
@ -214,6 +239,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
|
|
||||||
|
DefaultPageVaultCell.OnChanged += DefaultPageVaultCell_Changed;
|
||||||
AnalyticsCell.OnChanged += AnalyticsCell_Changed;
|
AnalyticsCell.OnChanged += AnalyticsCell_Changed;
|
||||||
WebsiteIconsCell.OnChanged += WebsiteIconsCell_Changed;
|
WebsiteIconsCell.OnChanged += WebsiteIconsCell_Changed;
|
||||||
CopyTotpCell.OnChanged += CopyTotpCell_OnChanged;
|
CopyTotpCell.OnChanged += CopyTotpCell_OnChanged;
|
||||||
|
@ -231,6 +257,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
base.OnDisappearing();
|
base.OnDisappearing();
|
||||||
|
|
||||||
|
DefaultPageVaultCell.OnChanged -= DefaultPageVaultCell_Changed;
|
||||||
AnalyticsCell.OnChanged -= AnalyticsCell_Changed;
|
AnalyticsCell.OnChanged -= AnalyticsCell_Changed;
|
||||||
WebsiteIconsCell.OnChanged -= WebsiteIconsCell_Changed;
|
WebsiteIconsCell.OnChanged -= WebsiteIconsCell_Changed;
|
||||||
CopyTotpCell.OnChanged -= CopyTotpCell_OnChanged;
|
CopyTotpCell.OnChanged -= CopyTotpCell_OnChanged;
|
||||||
|
@ -246,6 +273,7 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private void Layout_LayoutChanged(object sender, EventArgs e)
|
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;
|
AnalyticsLabel.WidthRequest = StackLayout.Bounds.Width - AnalyticsLabel.Bounds.Left * 2;
|
||||||
WebsiteIconsLabel.WidthRequest = StackLayout.Bounds.Width - WebsiteIconsLabel.Bounds.Left * 2;
|
WebsiteIconsLabel.WidthRequest = StackLayout.Bounds.Width - WebsiteIconsLabel.Bounds.Left * 2;
|
||||||
CopyTotpLabel.WidthRequest = StackLayout.Bounds.Width - CopyTotpLabel.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)
|
private void WebsiteIconsCell_Changed(object sender, ToggledEventArgs e)
|
||||||
{
|
{
|
||||||
var cell = sender as ExtendedSwitchCell;
|
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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Delete.
|
/// Looks up a localized string similar to Delete.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1197,4 +1197,10 @@
|
||||||
<data name="Collections" xml:space="preserve">
|
<data name="Collections" xml:space="preserve">
|
||||||
<value>Collections</value>
|
<value>Collections</value>
|
||||||
</data>
|
</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>
|
</root>
|
|
@ -14,6 +14,18 @@ namespace Bit.App.Services
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DefaultPageVault
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _settings.GetValueOrDefault(Constants.SettingDefaultPageVault, false);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_settings.AddOrUpdateValue(Constants.SettingDefaultPageVault, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool Locked
|
public bool Locked
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
Loading…
Reference in a new issue