mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-05 09:01:11 +01:00
[PS-1080] Added text alternative to Boolean custom field icon (#2000)
* PS-1080 Added new accessibility text property to the custom field bool icon * PS-1080 Added BoolValue property to the FieldView and added new AccessibilityProperty to bool icon
This commit is contained in:
parent
f809170c51
commit
263aeef030
@ -571,6 +571,8 @@
|
||||
IsVisible="{Binding IsLinkedType}" />
|
||||
<controls:IconLabel
|
||||
Text="{Binding ValueText, Mode=OneWay}"
|
||||
AutomationProperties.IsInAccessibleTree="true"
|
||||
AutomationProperties.Name="{Binding ValueAccessibilityText, Mode=OneWay}"
|
||||
StyleClass="box-value"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
|
@ -727,6 +727,7 @@ namespace Bit.App.Pages
|
||||
additionalPropertyNames: new string[]
|
||||
{
|
||||
nameof(ValueText),
|
||||
nameof(ValueAccessibilityText),
|
||||
nameof(IsBooleanType),
|
||||
nameof(IsHiddenType),
|
||||
nameof(IsTextType),
|
||||
@ -750,7 +751,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
if (IsBooleanType)
|
||||
{
|
||||
return _field.Value == "true" ? BitwardenIcons.CheckSquare : BitwardenIcons.Square;
|
||||
return _field.BoolValue ? BitwardenIcons.CheckSquare : BitwardenIcons.Square;
|
||||
}
|
||||
else if (IsLinkedType)
|
||||
{
|
||||
@ -764,6 +765,19 @@ namespace Bit.App.Pages
|
||||
}
|
||||
}
|
||||
|
||||
public string ValueAccessibilityText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsBooleanType)
|
||||
{
|
||||
return _field.BoolValue ? AppResources.Enabled : AppResources.Disabled;
|
||||
}
|
||||
|
||||
return ValueText;
|
||||
}
|
||||
}
|
||||
|
||||
public FormattedString ColoredHiddenValue => PasswordFormatter.FormatPassword(_field.Value);
|
||||
|
||||
public Command ToggleHiddenValueCommand { get; set; }
|
||||
|
@ -19,5 +19,6 @@ namespace Bit.Core.Models.View
|
||||
public string MaskedValue => Value != null ? "••••••••" : null;
|
||||
public bool NewField { get; set; }
|
||||
public LinkedIdType? LinkedId { get; set; }
|
||||
public bool BoolValue => bool.TryParse(Value, out var b) && b;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user