diff --git a/src/App/Pages/Settings/OptionsPage.xaml b/src/App/Pages/Settings/OptionsPage.xaml
index 05162f78b..969d5fffa 100644
--- a/src/App/Pages/Settings/OptionsPage.xaml
+++ b/src/App/Pages/Settings/OptionsPage.xaml
@@ -14,6 +14,22 @@
+
+
+
+
+
+
+
-
+
+
+
+
-
+ Text="{u:I18n AutofillAlways}"
+ StyleClass="box-label, box-label-regular"
+ HorizontalOptions="StartAndExpand" />
+
+ Text="{u:I18n AutofillAlwaysDescription}"
+ StyleClass="box-footer-label" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/App/Pages/Settings/OptionsPageViewModel.cs b/src/App/Pages/Settings/OptionsPageViewModel.cs
index 6d01743fa..235eb03a7 100644
--- a/src/App/Pages/Settings/OptionsPageViewModel.cs
+++ b/src/App/Pages/Settings/OptionsPageViewModel.cs
@@ -20,12 +20,17 @@ namespace Bit.App.Pages
private readonly IStateService _stateService;
private readonly IMessagingService _messagingService;
+
+ private bool _autofillAlwaysScan;
+ private bool _autofillPersistNotification;
+ private bool _autofillPasswordField;
private bool _disableFavicon;
private bool _disableAutoTotpCopy;
private int _clearClipboardSelectedIndex;
private int _themeSelectedIndex;
private int _uriMatchSelectedIndex;
private bool _inited;
+ private bool _updatingAutofill;
public OptionsPageViewModel()
{
@@ -129,10 +134,51 @@ namespace Bit.App.Pages
}
}
+ public bool AutofillAlwaysScan
+ {
+ get => _autofillAlwaysScan;
+ set
+ {
+ if(SetProperty(ref _autofillAlwaysScan, value))
+ {
+ var task = UpdateAutofillAsync(false, false);
+ }
+ }
+ }
+
+ public bool AutofillPersistNotification
+ {
+ get => _autofillPersistNotification;
+ set
+ {
+ if(SetProperty(ref _autofillPersistNotification, value))
+ {
+ var task = UpdateAutofillAsync(value, false);
+ }
+ }
+ }
+
+ public bool AutofillPasswordField
+ {
+ get => _autofillPasswordField;
+ set
+ {
+ if(SetProperty(ref _autofillPasswordField, value))
+ {
+ var task = UpdateAutofillAsync(false, value);
+ }
+ }
+ }
+
public async Task InitAsync()
{
+ AutofillPersistNotification = (await _storageService.GetAsync(
+ Constants.AccessibilityAutofillPersistNotificationKey)).GetValueOrDefault();
+ AutofillPasswordField = (await _storageService.GetAsync(
+ Constants.AccessibilityAutofillPasswordFieldKey)).GetValueOrDefault();
+ AutofillAlwaysScan = !AutofillPersistNotification && !AutofillPasswordField;
DisableAutoTotpCopy = !(await _totpService.IsAutoCopyEnabledAsync());
- DisableFavicon = await _storageService.GetAsync(Constants.DisableFaviconKey);
+ DisableFavicon = (await _storageService.GetAsync(Constants.DisableFaviconKey)).GetValueOrDefault();
var theme = await _storageService.GetAsync(Constants.ThemeKey);
ThemeSelectedIndex = ThemeOptions.FindIndex(k => k.Key == theme);
var defaultUriMatch = await _storageService.GetAsync(Constants.DefaultUriMatch);
@@ -143,6 +189,35 @@ namespace Bit.App.Pages
_inited = true;
}
+ private async Task UpdateAutofillAsync(bool persistNotification, bool passwordField)
+ {
+ if(_inited && !_updatingAutofill)
+ {
+ _updatingAutofill = true;
+ if(persistNotification)
+ {
+ AutofillAlwaysScan = false;
+ AutofillPasswordField = false;
+ }
+ else if(passwordField)
+ {
+ AutofillAlwaysScan = false;
+ AutofillPersistNotification = false;
+ }
+ else
+ {
+ AutofillAlwaysScan = true;
+ AutofillPersistNotification = false;
+ AutofillPasswordField = false;
+ }
+ await _storageService.SaveAsync(Constants.AccessibilityAutofillPersistNotificationKey,
+ AutofillPersistNotification);
+ await _storageService.SaveAsync(Constants.AccessibilityAutofillPasswordFieldKey,
+ AutofillPasswordField);
+ _updatingAutofill = false;
+ }
+ }
+
private async Task UpdateAutoTotpCopyAsync()
{
if(_inited)