Bitwarden-app-android-iphon.../src/App/Pages/Settings/OptionsPage.xaml.cs

65 lines
2.2 KiB
C#
Raw Normal View History

using Bit.App.Abstractions;
using Bit.App.Resources;
using Bit.Core.Utilities;
2019-05-29 20:11:15 +02:00
using Xamarin.Forms;
2019-06-24 23:32:24 +02:00
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
2019-05-29 15:08:47 +02:00
namespace Bit.App.Pages
{
public partial class OptionsPage : BaseContentPage
{
private readonly IDeviceActionService _deviceActionService;
2019-05-29 15:08:47 +02:00
private readonly OptionsPageViewModel _vm;
public OptionsPage()
{
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
2019-05-29 15:08:47 +02:00
InitializeComponent();
_vm = BindingContext as OptionsPageViewModel;
_vm.Page = this;
2019-05-29 20:11:15 +02:00
_themePicker.ItemDisplayBinding = new Binding("Value");
_uriMatchPicker.ItemDisplayBinding = new Binding("Value");
_clearClipboardPicker.ItemDisplayBinding = new Binding("Value");
if (Device.RuntimePlatform == Device.Android)
2019-05-30 05:02:30 +02:00
{
2019-06-12 03:31:51 +02:00
ToolbarItems.RemoveAt(0);
_vm.ShowAndroidAutofillSettings = _deviceActionService.SupportsAutofillService();
2019-05-30 05:02:30 +02:00
_themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ",
AppResources.RestartIsRequired);
}
2019-06-24 23:32:24 +02:00
else
{
_themePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
_uriMatchPicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
_clearClipboardPicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
}
2019-05-29 15:08:47 +02:00
}
2019-05-29 15:36:57 +02:00
protected async override void OnAppearing()
2019-05-29 15:08:47 +02:00
{
base.OnAppearing();
2019-05-29 15:36:57 +02:00
await _vm.InitAsync();
2019-05-29 15:08:47 +02:00
}
2019-06-03 16:45:27 +02:00
protected async override void OnDisappearing()
{
base.OnDisappearing();
await _vm.UpdateAutofillBlacklistedUris();
}
private async void BlacklistedUrisEditor_Unfocused(object sender, FocusEventArgs e)
{
await _vm.UpdateAutofillBlacklistedUris();
}
2019-06-12 03:31:51 +02:00
private async void Close_Clicked(object sender, System.EventArgs e)
{
if (DoOnce())
2019-06-12 03:31:51 +02:00
{
await Navigation.PopModalAsync();
}
}
2019-05-29 15:08:47 +02:00
}
}