1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-06-26 10:36:21 +02:00

Fixed password color and alignment on iOS password generator (#743)

This commit is contained in:
Matt Portune 2020-02-27 21:18:09 -05:00 committed by GitHub
parent f78f303a79
commit cf3d52772d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -68,6 +68,7 @@
Margin="0, 20"
StyleClass="text-lg"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand"
LineBreakMode="CharacterWrap" />
<Button Text="{u:I18n RegeneratePassword}"
HorizontalOptions="FillAndExpand"

View File

@ -30,8 +30,9 @@ namespace Bit.App.Utilities
// First two digits of returned hex code contains the alpha,
// which is not supported in HTML color, so we need to cut those out.
var numberColor = $"<span style=\"color:#{((Color)Application.Current.Resources["PasswordNumberColor"]).ToHex().Substring(2)}\">";
var specialColor = $"<span style=\"color:#{((Color)Application.Current.Resources["PasswordSpecialColor"]).ToHex().Substring(2)}\">";
var normalColor = $"<span style=\"color:#{((Color)Application.Current.Resources["TextColor"]).ToHex().Substring(3)}\">";
var numberColor = $"<span style=\"color:#{((Color)Application.Current.Resources["PasswordNumberColor"]).ToHex().Substring(3)}\">";
var specialColor = $"<span style=\"color:#{((Color)Application.Current.Resources["PasswordSpecialColor"]).ToHex().Substring(3)}\">";
var result = string.Empty;
// Start with an otherwise uncovered case so we will definitely enter the "something changed"
@ -59,7 +60,7 @@ namespace Bit.App.Utilities
if(charType != currentType)
{
// Close off previous span.
if (currentType != CharType.None && currentType != CharType.Normal)
if (currentType != CharType.None)
{
result += "</span>";
}
@ -71,6 +72,9 @@ namespace Bit.App.Utilities
switch(currentType)
{
// Apply color style to span.
case CharType.Normal:
result += normalColor;
break;
case CharType.Number:
result += numberColor;
break;
@ -83,7 +87,7 @@ namespace Bit.App.Utilities
}
// Close off last span.
if (currentType != CharType.None && currentType != CharType.Normal)
if (currentType != CharType.None)
{
result += "</span>";
}