mirror of
https://github.com/bitwarden/mobile
synced 2026-01-06 18:43:43 +00:00
disable website icons option
This commit is contained in:
@@ -28,6 +28,8 @@ namespace Bit.App.Pages
|
||||
private Label CopyTotpLabel { get; set; }
|
||||
private ExtendedSwitchCell AnalyticsCell { get; set; }
|
||||
private Label AnalyticsLabel { get; set; }
|
||||
private ExtendedSwitchCell WebsiteIconsCell { get; set; }
|
||||
private Label WebsiteIconsLabel { get; set; }
|
||||
private ExtendedSwitchCell AutofillPersistNotificationCell { get; set; }
|
||||
private Label AutofillPersistNotificationLabel { get; set; }
|
||||
private ExtendedSwitchCell AutofillPasswordFieldCell { get; set; }
|
||||
@@ -37,13 +39,30 @@ namespace Bit.App.Pages
|
||||
|
||||
private void Init()
|
||||
{
|
||||
WebsiteIconsCell = new ExtendedSwitchCell
|
||||
{
|
||||
Text = AppResources.DisableWebsiteIcons,
|
||||
On = _appSettings.DisableWebsiteIcons
|
||||
};
|
||||
|
||||
var websiteIconsTable = new FormTableView(true)
|
||||
{
|
||||
Root = new TableRoot
|
||||
{
|
||||
new TableSection(" ")
|
||||
{
|
||||
WebsiteIconsCell
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CopyTotpCell = new ExtendedSwitchCell
|
||||
{
|
||||
Text = AppResources.DisableAutoTotpCopy,
|
||||
On = _settings.GetValueOrDefault(Constants.SettingDisableTotpCopy, false)
|
||||
};
|
||||
|
||||
var totpTable = new FormTableView(true)
|
||||
var totpTable = new FormTableView
|
||||
{
|
||||
Root = new TableRoot
|
||||
{
|
||||
@@ -81,9 +100,19 @@ namespace Bit.App.Pages
|
||||
Text = AppResources.DisableGADescription
|
||||
};
|
||||
|
||||
WebsiteIconsLabel = new FormTableLabel(this)
|
||||
{
|
||||
Text = AppResources.DisableWebsiteIconsDescription
|
||||
};
|
||||
|
||||
StackLayout = new StackLayout
|
||||
{
|
||||
Children = { totpTable, CopyTotpLabel, analyticsTable, AnalyticsLabel },
|
||||
Children =
|
||||
{
|
||||
websiteIconsTable, WebsiteIconsLabel,
|
||||
totpTable, CopyTotpLabel,
|
||||
analyticsTable, AnalyticsLabel
|
||||
},
|
||||
Spacing = 0
|
||||
};
|
||||
|
||||
@@ -170,8 +199,9 @@ namespace Bit.App.Pages
|
||||
|
||||
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
|
||||
{
|
||||
analyticsTable.RowHeight = -1;
|
||||
analyticsTable.EstimatedRowHeight = 70;
|
||||
analyticsTable.RowHeight = websiteIconsTable.RowHeight = totpTable.RowHeight = -1;
|
||||
analyticsTable.EstimatedRowHeight = websiteIconsTable.EstimatedRowHeight =
|
||||
totpTable.EstimatedRowHeight = 70;
|
||||
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
|
||||
}
|
||||
|
||||
@@ -184,6 +214,7 @@ namespace Bit.App.Pages
|
||||
base.OnAppearing();
|
||||
|
||||
AnalyticsCell.OnChanged += AnalyticsCell_Changed;
|
||||
WebsiteIconsCell.OnChanged += WebsiteIconsCell_Changed;
|
||||
CopyTotpCell.OnChanged += CopyTotpCell_OnChanged;
|
||||
StackLayout.LayoutChanged += Layout_LayoutChanged;
|
||||
|
||||
@@ -200,6 +231,7 @@ namespace Bit.App.Pages
|
||||
base.OnDisappearing();
|
||||
|
||||
AnalyticsCell.OnChanged -= AnalyticsCell_Changed;
|
||||
WebsiteIconsCell.OnChanged -= WebsiteIconsCell_Changed;
|
||||
CopyTotpCell.OnChanged -= CopyTotpCell_OnChanged;
|
||||
StackLayout.LayoutChanged -= Layout_LayoutChanged;
|
||||
|
||||
@@ -214,6 +246,7 @@ namespace Bit.App.Pages
|
||||
private void Layout_LayoutChanged(object sender, EventArgs e)
|
||||
{
|
||||
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;
|
||||
|
||||
if(AutofillAlwaysLabel != null)
|
||||
@@ -233,6 +266,17 @@ namespace Bit.App.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private void WebsiteIconsCell_Changed(object sender, ToggledEventArgs e)
|
||||
{
|
||||
var cell = sender as ExtendedSwitchCell;
|
||||
if(cell == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_appSettings.DisableWebsiteIcons = cell.On;
|
||||
}
|
||||
|
||||
private void AnalyticsCell_Changed(object sender, ToggledEventArgs e)
|
||||
{
|
||||
var cell = sender as ExtendedSwitchCell;
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Bit.App.Pages
|
||||
private readonly IDeviceInfoService _deviceInfoService;
|
||||
private readonly IDeviceActionService _clipboardService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly IAppSettingsService _appSettingsService;
|
||||
private CancellationTokenSource _filterResultsCancellationTokenSource;
|
||||
private readonly string _name;
|
||||
|
||||
@@ -46,6 +47,7 @@ namespace Bit.App.Pages
|
||||
_clipboardService = Resolver.Resolve<IDeviceActionService>();
|
||||
_settingsService = Resolver.Resolve<ISettingsService>();
|
||||
UserDialogs = Resolver.Resolve<IUserDialogs>();
|
||||
_appSettingsService = Resolver.Resolve<IAppSettingsService>();
|
||||
GoogleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
|
||||
|
||||
Init();
|
||||
@@ -159,13 +161,15 @@ namespace Bit.App.Pages
|
||||
{
|
||||
var cts = new CancellationTokenSource();
|
||||
_filterResultsCancellationTokenSource?.Cancel();
|
||||
var websiteIconsEnabled = !_appSettingsService.DisableWebsiteIcons;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var autofillGroupings = new List<VaultListPageModel.AutofillGrouping>();
|
||||
var ciphers = await _cipherService.GetAllAsync(Uri);
|
||||
|
||||
var normalLogins = ciphers?.Item1.Select(l => new VaultListPageModel.AutofillCipher(l, false))
|
||||
var normalLogins = ciphers?.Item1.Select(l => new VaultListPageModel.AutofillCipher(
|
||||
l, websiteIconsEnabled, false))
|
||||
.OrderBy(s => s.Name)
|
||||
.ThenBy(s => s.Subtitle)
|
||||
.ToList();
|
||||
@@ -174,7 +178,8 @@ namespace Bit.App.Pages
|
||||
autofillGroupings.Add(new VaultListPageModel.AutofillGrouping(normalLogins, AppResources.MatchingItems));
|
||||
}
|
||||
|
||||
var fuzzyLogins = ciphers?.Item2.Select(l => new VaultListPageModel.AutofillCipher(l, true))
|
||||
var fuzzyLogins = ciphers?.Item2.Select(l => new VaultListPageModel.AutofillCipher(
|
||||
l, websiteIconsEnabled, true))
|
||||
.OrderBy(s => s.Name)
|
||||
.ThenBy(s => s.LoginUsername)
|
||||
.ToList();
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Bit.App.Pages
|
||||
private readonly IPushNotificationService _pushNotification;
|
||||
private readonly IDeviceInfoService _deviceInfoService;
|
||||
private readonly ISettings _settings;
|
||||
private readonly IAppSettingsService _appSettingsService;
|
||||
private readonly IGoogleAnalyticsService _googleAnalyticsService;
|
||||
private readonly bool _favorites;
|
||||
private CancellationTokenSource _filterResultsCancellationTokenSource;
|
||||
@@ -46,6 +47,7 @@ namespace Bit.App.Pages
|
||||
_pushNotification = Resolver.Resolve<IPushNotificationService>();
|
||||
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
|
||||
_settings = Resolver.Resolve<ISettings>();
|
||||
_appSettingsService = Resolver.Resolve<IAppSettingsService>();
|
||||
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
|
||||
|
||||
var cryptoService = Resolver.Resolve<ICryptoService>();
|
||||
@@ -309,6 +311,7 @@ namespace Bit.App.Pages
|
||||
}
|
||||
|
||||
_filterResultsCancellationTokenSource?.Cancel();
|
||||
var websiteIconsEnabled = !_appSettingsService.DisableWebsiteIcons;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
@@ -325,7 +328,7 @@ namespace Bit.App.Pages
|
||||
.ToArray();
|
||||
|
||||
Ciphers = ciphers
|
||||
.Select(s => new VaultListPageModel.Cipher(s))
|
||||
.Select(s => new VaultListPageModel.Cipher(s, websiteIconsEnabled))
|
||||
.OrderBy(s => s.Name)
|
||||
.ThenBy(s => s.Subtitle)
|
||||
.ToArray();
|
||||
|
||||
Reference in New Issue
Block a user