Added spaced card nubmer to the card view

This commit is contained in:
Mohammed Alhaddar 2024-03-15 19:32:25 +03:00
parent 9a9fb85ad8
commit a91399b3a8
2 changed files with 14 additions and 1 deletions

View File

@ -21,6 +21,19 @@ namespace Bit.Core.Models.View
public string Code { get; set; }
public string MaskedCode => Code != null ? new string('•', Code.Length) : null;
public string MaskedNumber => Number != null ? new string('•', Number.Length) : null;
public string SpacedNumber {
get {
if (Number == null) return null;
var sb = new StringBuilder();
for (int i = 0; i < Number.Length; i++) {
sb.Append(Number[i]);
if ((i + 1) % 4 == 0 && i + 1 < Number.Length) {
sb.Append(" ");
}
}
return sb.ToString();
}
}
public string Brand
{

View File

@ -313,7 +313,7 @@
IsVisible="{Binding ShowCardNumber, Converter={StaticResource inverseBool}}"
AutomationId="ItemValue" />
<controls:MonoLabel
Text="{Binding Cipher.Card.Number, Mode=OneWay}"
Text="{Binding Cipher.Card.SpacedNumber, Mode=OneWay}"
StyleClass="box-value"
Grid.Row="1"
Grid.Column="0"