ShowAndroidAutofillSettings

ShowAndroidAccessibilitySettings
This commit is contained in:
Kyle Spearrin 2019-06-03 23:20:59 -04:00
parent 44530b63ca
commit 42d6a7c9b8
3 changed files with 23 additions and 13 deletions

View file

@ -90,7 +90,7 @@
Text="{u:I18n DisableWebsiteIconsDescription}" Text="{u:I18n DisableWebsiteIconsDescription}"
StyleClass="box-footer-label, box-footer-label-switch" /> StyleClass="box-footer-label, box-footer-label-switch" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}"> <StackLayout StyleClass="box" IsVisible="{Binding ShowAndroidAutofillSettings}">
<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" />
@ -109,7 +109,7 @@
Text="{u:I18n DisableSavePromptDescription}" Text="{u:I18n DisableSavePromptDescription}"
StyleClass="box-footer-label, box-footer-label-switch" /> StyleClass="box-footer-label, box-footer-label-switch" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}"> <StackLayout StyleClass="box" IsVisible="{Binding ShowAndroidAutofillSettings}">
<StackLayout StyleClass="box-row, box-row-input"> <StackLayout StyleClass="box-row, box-row-input">
<Label <Label
Text="{u:I18n BlacklistedUris}" Text="{u:I18n BlacklistedUris}"
@ -128,7 +128,7 @@
Text="{u:I18n BlacklistedUrisDescription}" Text="{u:I18n BlacklistedUrisDescription}"
StyleClass="box-footer-label" /> StyleClass="box-footer-label" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}"> <StackLayout StyleClass="box" IsVisible="{Binding ShowAndroidAccessibilitySettings}">
<StackLayout StyleClass="box-row-header"> <StackLayout StyleClass="box-row-header">
<Label Text="{u:I18n AutofillAccessibilityService}" <Label Text="{u:I18n AutofillAccessibilityService}"
StyleClass="box-header, box-header-platform" /> StyleClass="box-header, box-header-platform" />
@ -147,7 +147,7 @@
Text="{u:I18n AutofillAlwaysDescription}" Text="{u:I18n AutofillAlwaysDescription}"
StyleClass="box-footer-label, box-footer-label-switch" /> StyleClass="box-footer-label, box-footer-label-switch" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}"> <StackLayout StyleClass="box" IsVisible="{Binding ShowAndroidAccessibilitySettings}">
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n AutofillPersistNotification}" Text="{u:I18n AutofillPersistNotification}"
@ -162,7 +162,7 @@
Text="{u:I18n AutofillPersistNotificationDescription}" Text="{u:I18n AutofillPersistNotificationDescription}"
StyleClass="box-footer-label, box-footer-label-switch" /> StyleClass="box-footer-label, box-footer-label-switch" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding AndroidOptions}"> <StackLayout StyleClass="box" IsVisible="{Binding ShowAndroidAccessibilitySettings}">
<StackLayout StyleClass="box-row, box-row-switch"> <StackLayout StyleClass="box-row, box-row-switch">
<Label <Label
Text="{u:I18n AutofillPasswordField}" Text="{u:I18n AutofillPasswordField}"

View file

@ -1,16 +1,18 @@
using Bit.App.Resources; using Bit.App.Abstractions;
using System; using Bit.App.Resources;
using System.Collections.Generic; using Bit.Core.Utilities;
using Xamarin.Forms; using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
public partial class OptionsPage : BaseContentPage public partial class OptionsPage : BaseContentPage
{ {
private readonly IDeviceActionService _deviceActionService;
private readonly OptionsPageViewModel _vm; private readonly OptionsPageViewModel _vm;
public OptionsPage() public OptionsPage()
{ {
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
InitializeComponent(); InitializeComponent();
_vm = BindingContext as OptionsPageViewModel; _vm = BindingContext as OptionsPageViewModel;
_vm.Page = this; _vm.Page = this;
@ -19,7 +21,8 @@ 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; _vm.ShowAndroidAccessibilitySettings = true;
_vm.ShowAndroidAutofillSettings = _deviceActionService.SupportsAutofillService();
_themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ", _themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ",
AppResources.RestartIsRequired); AppResources.RestartIsRequired);
} }

View file

@ -33,7 +33,8 @@ 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; private bool _showAndroidAccessibilitySettings;
private bool _showAndroidAutofillSettings;
public OptionsPageViewModel() public OptionsPageViewModel()
{ {
@ -195,10 +196,16 @@ namespace Bit.App.Pages
set => SetProperty(ref _autofillBlacklistedUris, value); set => SetProperty(ref _autofillBlacklistedUris, value);
} }
public bool AndroidOptions public bool ShowAndroidAccessibilitySettings
{ {
get => _androidOptions; get => _showAndroidAccessibilitySettings;
set => SetProperty(ref _androidOptions, value); set => SetProperty(ref _showAndroidAccessibilitySettings, value);
}
public bool ShowAndroidAutofillSettings
{
get => _showAndroidAutofillSettings;
set => SetProperty(ref _showAndroidAutofillSettings, value);
} }
public async Task InitAsync() public async Task InitAsync()