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}" Text="{u:I18n DisableWebsiteIconsDescription}"
StyleClass="box-footer-label" /> StyleClass="box-footer-label" />
</StackLayout> </StackLayout>
<StackLayout Spacing="0" Padding="0" IsVisible="{Binding AndroidOptions}"> <StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}">
<StackLayout StyleClass="box"> <StackLayout StyleClass="box-row-header">
<StackLayout StyleClass="box-row-header"> <Label Text="{u:I18n AutofillService}"
<Label Text="{u:I18n AutofillService}" StyleClass="box-header, box-header-platform" />
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> </StackLayout>
<StackLayout StyleClass="box"> <StackLayout StyleClass="box-row, box-row-switch">
<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>
<Label <Label
Text="{u:I18n BlacklistedUrisDescription}" Text="{u:I18n DisableSavePrompt}"
StyleClass="box-footer-label" /> StyleClass="box-label, box-label-regular"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding AutofillDisableSavePrompt}"
StyleClass="box-value"
HorizontalOptions="End" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box"> <Label
<StackLayout StyleClass="box-row-header"> Text="{u:I18n DisableSavePromptDescription}"
<Label Text="{u:I18n AutofillAccessibilityService}" StyleClass="box-footer-label" />
StyleClass="box-header, box-header-platform" /> </StackLayout>
</StackLayout> <StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}">
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-input">
<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 AutofillAlwaysDescription}" Text="{u:I18n BlacklistedUris}"
StyleClass="box-footer-label" /> 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>
<StackLayout StyleClass="box"> <Label
<StackLayout StyleClass="box-row, box-row-switch"> Text="{u:I18n BlacklistedUrisDescription}"
<Label StyleClass="box-footer-label" />
Text="{u:I18n AutofillPersistNotification}" </StackLayout>
StyleClass="box-label, box-label-regular" <StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}">
HorizontalOptions="StartAndExpand" /> <StackLayout StyleClass="box-row-header">
<Switch <Label Text="{u:I18n AutofillAccessibilityService}"
IsToggled="{Binding AutofillPersistNotification}" StyleClass="box-header, box-header-platform" />
StyleClass="box-value" </StackLayout>
HorizontalOptions="End" /> <StackLayout StyleClass="box-row, box-row-switch">
</StackLayout>
<Label <Label
Text="{u:I18n AutofillPersistNotificationDescription}" Text="{u:I18n AutofillAlways}"
StyleClass="box-footer-label" /> StyleClass="box-label, box-label-regular"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding AutofillAlwaysScan}"
StyleClass="box-value"
HorizontalOptions="End" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box"> <Label
<StackLayout StyleClass="box-row, box-row-switch"> Text="{u:I18n AutofillAlwaysDescription}"
<Label StyleClass="box-footer-label" />
Text="{u:I18n AutofillPasswordField}" </StackLayout>
StyleClass="box-label, box-label-regular" <StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}">
HorizontalOptions="StartAndExpand" /> <StackLayout StyleClass="box-row, box-row-switch">
<Switch
IsToggled="{Binding AutofillPasswordField}"
StyleClass="box-value"
HorizontalOptions="End" />
</StackLayout>
<Label <Label
Text="{u:I18n AutofillPasswordFieldDescription}" Text="{u:I18n AutofillPersistNotification}"
StyleClass="box-footer-label" /> StyleClass="box-label, box-label-regular"
HorizontalOptions="StartAndExpand" />
<Switch
IsToggled="{Binding AutofillPersistNotification}"
StyleClass="box-value"
HorizontalOptions="End" />
</StackLayout> </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>
</StackLayout> </StackLayout>
</ScrollView> </ScrollView>

View file

@ -328,12 +328,17 @@ namespace Bit.App.Pages
var urisList = new List<string>(); var urisList = new List<string>();
foreach(var uri in csv.Split(',')) foreach(var uri in csv.Split(','))
{ {
if(!uri.StartsWith("http://") && !uri.StartsWith("https://") && if(string.IsNullOrWhiteSpace(uri))
!uri.StartsWith(Constants.AndroidAppProtocol))
{ {
continue; 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); await _storageService.SaveAsync(Constants.AutofillBlacklistedUrisKey, urisList);
AutofillBlacklistedUris = string.Join(", ", urisList); AutofillBlacklistedUris = string.Join(", ", urisList);