cleanup options page a bit more

This commit is contained in:
Kyle Spearrin 2019-06-03 10:57:08 -04:00
parent cf4a6bb1a2
commit 59620e6435
2 changed files with 85 additions and 82 deletions

View file

@ -90,94 +90,92 @@
Text="{u:I18n DisableWebsiteIconsDescription}"
StyleClass="box-footer-label" />
</StackLayout>
<StackLayout Spacing="0" Padding="0" IsVisible="{Binding AndroidOptions}">
<StackLayout StyleClass="box">
<StackLayout StyleClass="box-row-header">
<Label Text="{u:I18n AutofillService}"
StyleClass="box-header, box-header-platform" />
</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
Text="{u:I18n DisableSavePromptDescription}"
StyleClass="box-footer-label" />
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}">
<StackLayout StyleClass="box-row-header">
<Label Text="{u:I18n AutofillService}"
StyleClass="box-header, box-header-platform" />
</StackLayout>
<StackLayout StyleClass="box">
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n BlacklistedUris}"
StyleClass="box-label" />
<Editor
x:Name="_blacklistedUrisEditor"
Text="{Binding AutofillBlacklistedUris}"
StyleClass="box-value"
AutoSize="TextChanges"
IsSpellCheckEnabled="False"
IsTextPredictionEnabled="False"
Keyboard="Plain"
Unfocused="BlacklistedUrisEditor_Unfocused" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n BlacklistedUrisDescription}"
StyleClass="box-footer-label" />
Text="{u:I18n DisableSavePrompt}"
StyleClass="box-label, box-label-regular"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding AutofillDisableSavePrompt}"
StyleClass="box-value"
HorizontalOptions="End" />
</StackLayout>
<StackLayout StyleClass="box">
<StackLayout StyleClass="box-row-header">
<Label Text="{u:I18n AutofillAccessibilityService}"
StyleClass="box-header, box-header-platform" />
</StackLayout>
<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
Text="{u:I18n DisableSavePromptDescription}"
StyleClass="box-footer-label" />
</StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}">
<StackLayout StyleClass="box-row, box-row-input">
<Label
Text="{u:I18n AutofillAlwaysDescription}"
StyleClass="box-footer-label" />
Text="{u:I18n BlacklistedUris}"
StyleClass="box-label" />
<Editor
x:Name="_blacklistedUrisEditor"
Text="{Binding AutofillBlacklistedUris}"
StyleClass="box-value"
AutoSize="TextChanges"
IsSpellCheckEnabled="False"
IsTextPredictionEnabled="False"
Keyboard="Url"
Unfocused="BlacklistedUrisEditor_Unfocused" />
</StackLayout>
<StackLayout StyleClass="box">
<StackLayout StyleClass="box-row, box-row-switch">
<Label
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 BlacklistedUrisDescription}"
StyleClass="box-footer-label" />
</StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}">
<StackLayout StyleClass="box-row-header">
<Label Text="{u:I18n AutofillAccessibilityService}"
StyleClass="box-header, box-header-platform" />
</StackLayout>
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n AutofillPersistNotificationDescription}"
StyleClass="box-footer-label" />
Text="{u:I18n AutofillAlways}"
StyleClass="box-label, box-label-regular"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding AutofillAlwaysScan}"
StyleClass="box-value"
HorizontalOptions="End" />
</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 AutofillAlwaysDescription}"
StyleClass="box-footer-label" />
</StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}">
<StackLayout StyleClass="box-row, box-row-switch">
<Label
Text="{u:I18n AutofillPasswordFieldDescription}"
StyleClass="box-footer-label" />
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" IsVisible="{Binding AndroidOptions}">
<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>
</ScrollView>

View file

@ -328,12 +328,17 @@ namespace Bit.App.Pages
var urisList = new List<string>();
foreach(var uri in csv.Split(','))
{
if(!uri.StartsWith("http://") && !uri.StartsWith("https://") &&
!uri.StartsWith(Constants.AndroidAppProtocol))
if(string.IsNullOrWhiteSpace(uri))
{
continue;
}
urisList.Add(uri.Replace("\\n", string.Empty).Trim());
var cleanedUri = uri.Replace(System.Environment.NewLine, string.Empty).Trim();
if(!cleanedUri.StartsWith("http://") && !cleanedUri.StartsWith("https://") &&
!cleanedUri.StartsWith(Constants.AndroidAppProtocol))
{
continue;
}
urisList.Add(cleanedUri);
}
await _storageService.SaveAsync(Constants.AutofillBlacklistedUrisKey, urisList);
AutofillBlacklistedUris = string.Join(", ", urisList);