From dd52ff0dccb45c067f0a36877e741c14c089a19c Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Tue, 18 Jul 2023 11:25:38 -0300 Subject: [PATCH] [PM-2320] Improve Android block Auto-fill URIs (#2616) * PM-2320 Added new view for block autofill URIs on Android * PM-2320 Fix formatting * PM-2320 Improved validations on block autofill uris * PM-2320 Improved autofill block uris placeholder colors on different themes --- src/Android/Android.csproj | 12 ++ src/Android/Renderers/CustomLabelRenderer.cs | 24 ++- .../drawable/empty_uris_placeholder.xml | 35 ++++ .../drawable/empty_uris_placeholder_dark.xml | 35 ++++ .../validatable_input_dialog_layout.xml | 27 +++ src/Android/Resources/values/dimens.xml | 3 + src/Android/Services/DeviceActionService.cs | 96 ++++++++- src/App/Abstractions/IDeviceActionService.cs | 2 + src/App/App.csproj | 2 + src/App/Controls/CustomLabel.cs | 6 +- .../Pages/Settings/BlockAutofillUrisPage.xaml | 85 ++++++++ .../Settings/BlockAutofillUrisPage.xaml.cs | 44 +++++ .../BlockAutofillUrisPageViewModel.cs | 186 ++++++++++++++++++ src/App/Pages/Settings/OptionsPage.xaml | 22 +-- src/App/Pages/Settings/OptionsPage.xaml.cs | 15 +- .../Pages/Settings/OptionsPageViewModel.cs | 54 +---- src/App/Resources/AppResources.Designer.cs | 135 ++++++++++++- src/App/Resources/AppResources.resx | 49 ++++- src/App/Styles/Base.xaml | 16 ++ .../Prompts/ValidatablePromptConfig.cs | 29 +++ src/iOS.Core/Services/DeviceActionService.cs | 6 + 21 files changed, 783 insertions(+), 100 deletions(-) create mode 100644 src/Android/Resources/drawable/empty_uris_placeholder.xml create mode 100644 src/Android/Resources/drawable/empty_uris_placeholder_dark.xml create mode 100644 src/Android/Resources/layout/validatable_input_dialog_layout.xml create mode 100644 src/App/Pages/Settings/BlockAutofillUrisPage.xaml create mode 100644 src/App/Pages/Settings/BlockAutofillUrisPage.xaml.cs create mode 100644 src/App/Pages/Settings/BlockAutofillUrisPageViewModel.cs create mode 100644 src/App/Utilities/Prompts/ValidatablePromptConfig.cs diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index c5f838ff8..8561fb4f1 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -233,6 +233,18 @@ + + + + + + + + + + + + diff --git a/src/Android/Renderers/CustomLabelRenderer.cs b/src/Android/Renderers/CustomLabelRenderer.cs index 62287087d..838b9b967 100644 --- a/src/Android/Renderers/CustomLabelRenderer.cs +++ b/src/Android/Renderers/CustomLabelRenderer.cs @@ -1,10 +1,10 @@ -using System; -using Bit.App.Controls; -using System.ComponentModel; -using Xamarin.Forms.Platform.Android; +using System.ComponentModel; using Android.Content; -using Xamarin.Forms; +using Android.OS; +using Bit.App.Controls; using Bit.Droid.Renderers; +using Xamarin.Forms; +using Xamarin.Forms.Platform.Android; [assembly: ExportRenderer(typeof(CustomLabel), typeof(CustomLabelRenderer))] namespace Bit.Droid.Renderers @@ -15,6 +15,19 @@ namespace Bit.Droid.Renderers : base(context) { } + protected override void OnElementChanged(ElementChangedEventArgs @@ -442,5 +443,6 @@ + diff --git a/src/App/Controls/CustomLabel.cs b/src/App/Controls/CustomLabel.cs index e822d3304..77d1fda79 100644 --- a/src/App/Controls/CustomLabel.cs +++ b/src/App/Controls/CustomLabel.cs @@ -1,5 +1,4 @@ -using System; -using Xamarin.Forms; +using Xamarin.Forms; namespace Bit.App.Controls { @@ -8,6 +7,7 @@ namespace Bit.App.Controls public CustomLabel() { } + + public int? FontWeight { get; set; } } } - diff --git a/src/App/Pages/Settings/BlockAutofillUrisPage.xaml b/src/App/Pages/Settings/BlockAutofillUrisPage.xaml new file mode 100644 index 000000000..8514edcad --- /dev/null +++ b/src/App/Pages/Settings/BlockAutofillUrisPage.xaml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +