mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
new autofill options
This commit is contained in:
parent
59f1dcca12
commit
8658ebd6bb
6 changed files with 214 additions and 42 deletions
|
@ -90,54 +90,94 @@
|
||||||
Text="{u:I18n DisableWebsiteIconsDescription}"
|
Text="{u:I18n DisableWebsiteIconsDescription}"
|
||||||
StyleClass="box-footer-label" />
|
StyleClass="box-footer-label" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout StyleClass="box">
|
<StackLayout Spacing="0" Padding="0" IsVisible="{Binding AndroidOptions}">
|
||||||
<StackLayout StyleClass="box-row-header">
|
<StackLayout StyleClass="box">
|
||||||
<Label Text="{u:I18n AutofillAccessibilityService}"
|
<StackLayout StyleClass="box-row-header">
|
||||||
StyleClass="box-header, box-header-platform" />
|
<Label Text="{u:I18n AutofillService}"
|
||||||
</StackLayout>
|
StyleClass="box-header, box-header-platform" />
|
||||||
<StackLayout StyleClass="box-row, box-row-switch">
|
</StackLayout>
|
||||||
|
<StackLayout StyleClass="box-row, box-row-switch">
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n DisableSavePrompt}"
|
||||||
|
StyleClass="box-label, box-label-regular"
|
||||||
|
HorizontalOptions="StartAndExpand" />
|
||||||
|
<Switch
|
||||||
|
IsToggled="{Binding AutofillDisableSavePrompt}"
|
||||||
|
StyleClass="box-value"
|
||||||
|
HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n AutofillAlways}"
|
Text="{u:I18n DisableSavePromptDescription}"
|
||||||
StyleClass="box-label, box-label-regular"
|
StyleClass="box-footer-label" />
|
||||||
HorizontalOptions="StartAndExpand" />
|
|
||||||
<Switch
|
|
||||||
IsToggled="{Binding AutofillAlwaysScan}"
|
|
||||||
StyleClass="box-value"
|
|
||||||
HorizontalOptions="End" />
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Label
|
<StackLayout StyleClass="box">
|
||||||
Text="{u:I18n AutofillAlwaysDescription}"
|
<StackLayout StyleClass="box-row, box-row-input">
|
||||||
StyleClass="box-footer-label" />
|
<Label
|
||||||
</StackLayout>
|
Text="{u:I18n BlacklistedUris}"
|
||||||
<StackLayout StyleClass="box">
|
StyleClass="box-label" />
|
||||||
<StackLayout StyleClass="box-row, box-row-switch">
|
<Editor
|
||||||
|
x:Name="_blacklistedUrisEditor"
|
||||||
|
Text="{Binding AutofillBlacklistedUris}"
|
||||||
|
StyleClass="box-value"
|
||||||
|
AutoSize="TextChanges"
|
||||||
|
IsSpellCheckEnabled="False"
|
||||||
|
IsTextPredictionEnabled="False"
|
||||||
|
Keyboard="Plain"
|
||||||
|
Unfocused="BlacklistedUrisEditor_Unfocused" />
|
||||||
|
</StackLayout>
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n AutofillPersistNotification}"
|
Text="{u:I18n BlacklistedUrisDescription}"
|
||||||
StyleClass="box-label, box-label-regular"
|
StyleClass="box-footer-label" />
|
||||||
HorizontalOptions="StartAndExpand" />
|
|
||||||
<Switch
|
|
||||||
IsToggled="{Binding AutofillPersistNotification}"
|
|
||||||
StyleClass="box-value"
|
|
||||||
HorizontalOptions="End" />
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Label
|
<StackLayout StyleClass="box">
|
||||||
Text="{u:I18n AutofillPersistNotificationDescription}"
|
<StackLayout StyleClass="box-row-header">
|
||||||
StyleClass="box-footer-label" />
|
<Label Text="{u:I18n AutofillAccessibilityService}"
|
||||||
</StackLayout>
|
StyleClass="box-header, box-header-platform" />
|
||||||
<StackLayout StyleClass="box">
|
</StackLayout>
|
||||||
<StackLayout StyleClass="box-row, box-row-switch">
|
<StackLayout StyleClass="box-row, box-row-switch">
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n AutofillAlways}"
|
||||||
|
StyleClass="box-label, box-label-regular"
|
||||||
|
HorizontalOptions="StartAndExpand" />
|
||||||
|
<Switch
|
||||||
|
IsToggled="{Binding AutofillAlwaysScan}"
|
||||||
|
StyleClass="box-value"
|
||||||
|
HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n AutofillPasswordField}"
|
Text="{u:I18n AutofillAlwaysDescription}"
|
||||||
StyleClass="box-label, box-label-regular"
|
StyleClass="box-footer-label" />
|
||||||
HorizontalOptions="StartAndExpand" />
|
</StackLayout>
|
||||||
<Switch
|
<StackLayout StyleClass="box">
|
||||||
IsToggled="{Binding AutofillPasswordField}"
|
<StackLayout StyleClass="box-row, box-row-switch">
|
||||||
StyleClass="box-value"
|
<Label
|
||||||
HorizontalOptions="End" />
|
Text="{u:I18n AutofillPersistNotification}"
|
||||||
|
StyleClass="box-label, box-label-regular"
|
||||||
|
HorizontalOptions="StartAndExpand" />
|
||||||
|
<Switch
|
||||||
|
IsToggled="{Binding AutofillPersistNotification}"
|
||||||
|
StyleClass="box-value"
|
||||||
|
HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n AutofillPersistNotificationDescription}"
|
||||||
|
StyleClass="box-footer-label" />
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout StyleClass="box">
|
||||||
|
<StackLayout StyleClass="box-row, box-row-switch">
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n AutofillPasswordField}"
|
||||||
|
StyleClass="box-label, box-label-regular"
|
||||||
|
HorizontalOptions="StartAndExpand" />
|
||||||
|
<Switch
|
||||||
|
IsToggled="{Binding AutofillPasswordField}"
|
||||||
|
StyleClass="box-value"
|
||||||
|
HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n AutofillPasswordFieldDescription}"
|
||||||
|
StyleClass="box-footer-label" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Label
|
|
||||||
Text="{u:I18n AutofillPasswordFieldDescription}"
|
|
||||||
StyleClass="box-footer-label" />
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace Bit.App.Pages
|
||||||
_clearClipboardPicker.ItemDisplayBinding = new Binding("Value");
|
_clearClipboardPicker.ItemDisplayBinding = new Binding("Value");
|
||||||
if(Device.RuntimePlatform == Device.Android)
|
if(Device.RuntimePlatform == Device.Android)
|
||||||
{
|
{
|
||||||
|
_vm.AndroidOptions = true;
|
||||||
_themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ",
|
_themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ",
|
||||||
AppResources.RestartIsRequired);
|
AppResources.RestartIsRequired);
|
||||||
}
|
}
|
||||||
|
@ -29,5 +30,16 @@ namespace Bit.App.Pages
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
await _vm.InitAsync();
|
await _vm.InitAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async override void OnDisappearing()
|
||||||
|
{
|
||||||
|
base.OnDisappearing();
|
||||||
|
await _vm.UpdateAutofillBlacklistedUris();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void BlacklistedUrisEditor_Unfocused(object sender, FocusEventArgs e)
|
||||||
|
{
|
||||||
|
await _vm.UpdateAutofillBlacklistedUris();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ namespace Bit.App.Pages
|
||||||
private bool _autofillAlwaysScan;
|
private bool _autofillAlwaysScan;
|
||||||
private bool _autofillPersistNotification;
|
private bool _autofillPersistNotification;
|
||||||
private bool _autofillPasswordField;
|
private bool _autofillPasswordField;
|
||||||
|
private bool _autofillDisableSavePrompt;
|
||||||
|
private string _autofillBlacklistedUris;
|
||||||
private bool _disableFavicon;
|
private bool _disableFavicon;
|
||||||
private bool _disableAutoTotpCopy;
|
private bool _disableAutoTotpCopy;
|
||||||
private int _clearClipboardSelectedIndex;
|
private int _clearClipboardSelectedIndex;
|
||||||
|
@ -31,6 +33,7 @@ namespace Bit.App.Pages
|
||||||
private int _uriMatchSelectedIndex;
|
private int _uriMatchSelectedIndex;
|
||||||
private bool _inited;
|
private bool _inited;
|
||||||
private bool _updatingAutofill;
|
private bool _updatingAutofill;
|
||||||
|
private bool _androidOptions;
|
||||||
|
|
||||||
public OptionsPageViewModel()
|
public OptionsPageViewModel()
|
||||||
{
|
{
|
||||||
|
@ -174,8 +177,37 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AutofillDisableSavePrompt
|
||||||
|
{
|
||||||
|
get => _autofillDisableSavePrompt;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(SetProperty(ref _autofillDisableSavePrompt, value))
|
||||||
|
{
|
||||||
|
var task = UpdateAutofillDisableSavePromptAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AutofillBlacklistedUris
|
||||||
|
{
|
||||||
|
get => _autofillBlacklistedUris;
|
||||||
|
set => SetProperty(ref _autofillBlacklistedUris, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AndroidOptions
|
||||||
|
{
|
||||||
|
get => _androidOptions;
|
||||||
|
set => SetProperty(ref _androidOptions, value);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task InitAsync()
|
public async Task InitAsync()
|
||||||
{
|
{
|
||||||
|
AutofillDisableSavePrompt = (await _storageService.GetAsync<bool?>(
|
||||||
|
Constants.AutofillDisableSavePromptKey)).GetValueOrDefault();
|
||||||
|
var blacklistedUrisList = await _storageService.GetAsync<List<string>>(
|
||||||
|
Constants.AutofillBlacklistedUrisKey);
|
||||||
|
AutofillBlacklistedUris = blacklistedUrisList != null ? string.Join(", ", blacklistedUrisList) : null;
|
||||||
AutofillPersistNotification = (await _storageService.GetAsync<bool?>(
|
AutofillPersistNotification = (await _storageService.GetAsync<bool?>(
|
||||||
Constants.AccessibilityAutofillPersistNotificationKey)).GetValueOrDefault();
|
Constants.AccessibilityAutofillPersistNotificationKey)).GetValueOrDefault();
|
||||||
AutofillPasswordField = (await _storageService.GetAsync<bool?>(
|
AutofillPasswordField = (await _storageService.GetAsync<bool?>(
|
||||||
|
@ -271,5 +303,43 @@ namespace Bit.App.Pages
|
||||||
(int?)UriMatchOptions[UriMatchSelectedIndex].Key);
|
(int?)UriMatchOptions[UriMatchSelectedIndex].Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task UpdateAutofillDisableSavePromptAsync()
|
||||||
|
{
|
||||||
|
if(_inited)
|
||||||
|
{
|
||||||
|
await _storageService.SaveAsync(Constants.AutofillDisableSavePromptKey, AutofillDisableSavePrompt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateAutofillBlacklistedUris()
|
||||||
|
{
|
||||||
|
if(_inited)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(AutofillBlacklistedUris))
|
||||||
|
{
|
||||||
|
await _storageService.RemoveAsync(Constants.AutofillBlacklistedUrisKey);
|
||||||
|
AutofillBlacklistedUris = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var csv = AutofillBlacklistedUris;
|
||||||
|
var urisList = new List<string>();
|
||||||
|
foreach(var uri in csv.Split(','))
|
||||||
|
{
|
||||||
|
if(!uri.StartsWith("http://") && !uri.StartsWith("https://") &&
|
||||||
|
!uri.StartsWith(Constants.AndroidAppProtocol))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
urisList.Add(uri.Replace("\\n", string.Empty).Trim());
|
||||||
|
}
|
||||||
|
await _storageService.SaveAsync(Constants.AutofillBlacklistedUrisKey, urisList);
|
||||||
|
AutofillBlacklistedUris = string.Join(", ", urisList);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
36
src/App/Resources/AppResources.Designer.cs
generated
36
src/App/Resources/AppResources.Designer.cs
generated
|
@ -735,6 +735,24 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Blacklisted URIs.
|
||||||
|
/// </summary>
|
||||||
|
public static string BlacklistedUris {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("BlacklistedUris", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to URIs that are blacklisted will not offer auto-fill. The list of apps should be comma separated. Ex: "https://twitter.com, androidapp://com.twitter.android"..
|
||||||
|
/// </summary>
|
||||||
|
public static string BlacklistedUrisDescription {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("BlacklistedUrisDescription", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Brand.
|
/// Looks up a localized string similar to Brand.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1230,6 +1248,24 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Disable Save Prompt.
|
||||||
|
/// </summary>
|
||||||
|
public static string DisableSavePrompt {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("DisableSavePrompt", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to The "Save Prompt" automatically prompts you to save new items to your vault whenever you enter them for the first time..
|
||||||
|
/// </summary>
|
||||||
|
public static string DisableSavePromptDescription {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("DisableSavePromptDescription", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Disable Website Icons.
|
/// Looks up a localized string similar to Disable Website Icons.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1580,4 +1580,16 @@
|
||||||
<value>Black</value>
|
<value>Black</value>
|
||||||
<comment>The color black</comment>
|
<comment>The color black</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="BlacklistedUris" xml:space="preserve">
|
||||||
|
<value>Blacklisted URIs</value>
|
||||||
|
</data>
|
||||||
|
<data name="BlacklistedUrisDescription" xml:space="preserve">
|
||||||
|
<value>URIs that are blacklisted will not offer auto-fill. The list of apps should be comma separated. Ex: "https://twitter.com, androidapp://com.twitter.android".</value>
|
||||||
|
</data>
|
||||||
|
<data name="DisableSavePrompt" xml:space="preserve">
|
||||||
|
<value>Disable Save Prompt</value>
|
||||||
|
</data>
|
||||||
|
<data name="DisableSavePromptDescription" xml:space="preserve">
|
||||||
|
<value>The "Save Prompt" automatically prompts you to save new items to your vault whenever you enter them for the first time.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -15,6 +15,8 @@
|
||||||
public static string LastFileCacheClearKey = "lastFileCacheClear";
|
public static string LastFileCacheClearKey = "lastFileCacheClear";
|
||||||
public static string AccessibilityAutofillPasswordFieldKey = "accessibilityAutofillPasswordField";
|
public static string AccessibilityAutofillPasswordFieldKey = "accessibilityAutofillPasswordField";
|
||||||
public static string AccessibilityAutofillPersistNotificationKey = "accessibilityAutofillPersistNotification";
|
public static string AccessibilityAutofillPersistNotificationKey = "accessibilityAutofillPersistNotification";
|
||||||
|
public static string AutofillDisableSavePromptKey = "autofillDisableSavePrompt";
|
||||||
|
public static string AutofillBlacklistedUrisKey = "autofillBlacklistedUris";
|
||||||
public static string DisableFaviconKey = "disableFavicon";
|
public static string DisableFaviconKey = "disableFavicon";
|
||||||
public static string PushRegisteredTokenKey = "pushRegisteredToken";
|
public static string PushRegisteredTokenKey = "pushRegisteredToken";
|
||||||
public static string PushCurrentTokenKey = "pushCurrentToken";
|
public static string PushCurrentTokenKey = "pushCurrentToken";
|
||||||
|
|
Loading…
Reference in a new issue