From a3716bc841efedfe4bc5bdd743fb2829c92d3829 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 3 Jun 2019 11:26:16 -0400 Subject: [PATCH] settings enabled/disabled text --- .../Pages/Settings/SettingsPage/SettingsPage.xaml | 5 +++-- .../Settings/SettingsPage/SettingsPageListItem.cs | 10 +++++++++- .../Settings/SettingsPage/SettingsPageViewModel.cs | 14 ++++++++++---- src/App/Pages/Vault/ViewPage.xaml.cs | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml index 91e82992c..4dee1c0fe 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml +++ b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml @@ -15,7 +15,7 @@ - + @@ -32,7 +32,8 @@ HorizontalOptions="End" HorizontalTextAlignment="End" VerticalOptions="CenterAndExpand" - StyleClass="list-sub"/> + TextColor="{Binding SubLabelColor}" + StyleClass="list-sub" /> diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageListItem.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageListItem.cs index dce875912..1140dc276 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageListItem.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageListItem.cs @@ -1,9 +1,17 @@ -namespace Bit.App.Pages +using Bit.App.Resources; +using System.Collections.Generic; +using Xamarin.Forms; + +namespace Bit.App.Pages { public class SettingsPageListItem { public string Icon { get; set; } public string Name { get; set; } public string SubLabel { get; set; } + public bool SubLabelTextEnabled => SubLabel == AppResources.Enabled; + public Color SubLabelColor => SubLabelTextEnabled ? + (Color)Application.Current.Resources["SuccessColor"] : + (Color)Application.Current.Resources["MutedColor"]; } } diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs index 4657a7e16..91869618b 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs @@ -281,13 +281,15 @@ namespace Bit.App.Pages autofillItems.Add(new SettingsPageListItem { Name = AppResources.AutofillService, - SubLabel = _deviceActionService.AutofillServiceEnabled() ? "✓" : null + SubLabel = _deviceActionService.AutofillServiceEnabled() ? + AppResources.Enabled : AppResources.Disabled }); } autofillItems.Add(new SettingsPageListItem { Name = AppResources.AutofillAccessibilityService, - SubLabel = _deviceActionService.AutofillAccessibilityServiceRunning() ? "✓" : null + SubLabel = _deviceActionService.AutofillAccessibilityServiceRunning() ? + AppResources.Enabled : AppResources.Disabled }); } else @@ -306,7 +308,11 @@ namespace Bit.App.Pages var securityItems = new List { new SettingsPageListItem { Name = AppResources.LockOptions, SubLabel = _lockOptionValue }, - new SettingsPageListItem { Name = AppResources.UnlockWithPIN, SubLabel = _pin ? "✓" : null }, + new SettingsPageListItem + { + Name = AppResources.UnlockWithPIN, + SubLabel = _pin ? AppResources.Enabled : AppResources.Disabled + }, new SettingsPageListItem { Name = AppResources.LockNow }, new SettingsPageListItem { Name = AppResources.TwoStepLogin } }; @@ -315,7 +321,7 @@ namespace Bit.App.Pages var item = new SettingsPageListItem { Name = string.Format(AppResources.UnlockWith, _fingerprintName), - SubLabel = _fingerprint ? "✓" : null + SubLabel = _fingerprint ? AppResources.Enabled : AppResources.Disabled }; securityItems.Insert(1, item); } diff --git a/src/App/Pages/Vault/ViewPage.xaml.cs b/src/App/Pages/Vault/ViewPage.xaml.cs index d1d098024..43dc43e70 100644 --- a/src/App/Pages/Vault/ViewPage.xaml.cs +++ b/src/App/Pages/Vault/ViewPage.xaml.cs @@ -34,7 +34,7 @@ namespace Bit.App.Pages protected override async void OnAppearing() { base.OnAppearing(); - _broadcasterService.Subscribe(nameof(ViewPage), async (message) => + _broadcasterService.Subscribe(nameof(ViewPage), (message) => { if(message.Command == "syncCompleted") {