1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-06 02:23:57 +00:00

Fixed some Large Font Accessibility issues on Vault and Send screens for Icons Display #1774 (#1785)

This commit is contained in:
Federico Maccaroni
2022-02-17 19:34:22 -03:00
committed by GitHub
parent dbaa32b02c
commit ea471b0749
14 changed files with 81 additions and 17 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using Bit.App.Controls;
using Bit.iOS.Core.Renderers;
using Bit.iOS.Core.Utilities;
using UIKit;
@@ -48,10 +49,19 @@ namespace Bit.iOS.Core.Renderers
if (Element is null || Control is null)
return;
var pointSize = iOSHelpers.GetAccessibleFont<Label>(Element.FontSize);
var pointSize = iOSHelpers.GetAccessibleFont<Label>(Element.FontSize);
if (pointSize != null)
{
Control.Font = UIFont.FromDescriptor(Element.Font.ToUIFont().FontDescriptor, pointSize.Value);
Control.Font = UIFont.FromDescriptor(Element.ToUIFont().FontDescriptor, pointSize.Value);
}
// TODO: For now, I'm only doing this for IconLabel with setup just in case I break the whole app labels.
// We need to revisit this when we address Accessibility Large Font issues across the app
// to check if we can left it more generic like
// else if (Element.FontFamily != null)
else if (Element is IconLabel iconLabel && iconLabel.ShouldUpdateFontSizeDynamicallyForAccesibility)
{
var customFont = Element.ToUIFont();
Control.Font = new UIFontMetrics(UIFontTextStyle.Body.GetConstant()).GetScaledFont(customFont);
}
}
}