1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-27 12:26:31 +01:00

settings enabled/disabled text

This commit is contained in:
Kyle Spearrin 2019-06-03 11:26:16 -04:00
parent e8c776fe49
commit a3716bc841
4 changed files with 23 additions and 8 deletions

View File

@ -15,7 +15,7 @@
<ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" />
<u:StringHasValueConverter x:Key="stringHasValue" />
<DataTemplate
x:Key="regularTemplate"
x:DataType="pages:SettingsPageListItem">
@ -32,7 +32,8 @@
HorizontalOptions="End"
HorizontalTextAlignment="End"
VerticalOptions="CenterAndExpand"
StyleClass="list-sub"/>
TextColor="{Binding SubLabelColor}"
StyleClass="list-sub" />
</StackLayout>
</ViewCell>
</DataTemplate>

View File

@ -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"];
}
}

View File

@ -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<SettingsPageListItem>
{
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);
}

View File

@ -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")
{