1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-19 08:53:17 +00:00

PM-3350 Fixed/Updated all MAUI-Migration TODOs

This commit is contained in:
Federico Maccaroni
2023-11-20 13:10:03 -03:00
parent 16ada4993c
commit 1a0b52d644
15 changed files with 51 additions and 127 deletions

View File

@@ -21,7 +21,7 @@ namespace Bit.iOS.Core.Utilities
_logger = ServiceContainer.Resolve<ILogger>("logger");
}
public async Task<UIImage> CreateAvatarImageAsync()
public async Task<UIImage?> CreateAvatarImageAsync()
{
try
{
@@ -66,11 +66,11 @@ namespace Bit.iOS.Core.Utilities
overlay.BindingContext = vm;
overlay.IsVisible = false;
// TODO: [MAUI-Migration] [Critical] check how to create a native view here.
//var renderer = Platform.CreateRenderer(overlay.Content);
//renderer.SetElementSize(new Size(containerView.Frame.Size.Width, containerView.Frame.Size.Height));
if (MauiContextSingleton.Instance.MauiContext is null)
{
throw new ArgumentNullException("Maui context should be set to create the account switching overlay view");
}
//var view = renderer.NativeView;
var view = overlay.ToPlatform(MauiContextSingleton.Instance.MauiContext);
view.TranslatesAutoresizingMaskIntoConstraints = false;

View File

@@ -4,8 +4,6 @@ namespace Bit.iOS.Core.Utilities
{
public static class FontElementExtensions
{
// TODO: [MAUI-Migration] [Critical] Compiling but big untested change
public static UIFont ToUIFont(this Microsoft.Maui.Font font)
{
var fontSize = font.Size;

View File

@@ -1,64 +1,64 @@
using Bit.App.Utilities;
using Microsoft.Maui.Controls.Compatibility.Platform.iOS;
using Microsoft.Maui.Platform;
using UIKit;
namespace Bit.iOS.Core.Utilities
{
public static class ThemeHelpers
{
public static bool LightTheme = true;
public static bool LightTheme { get; private set; } = true;
public static UIColor SplashBackgroundColor
{
get => ThemeManager.GetResourceColor("SplashBackgroundColor").ToUIColor();
get => ThemeManager.GetResourceColor("SplashBackgroundColor").ToPlatform();
}
public static UIColor BackgroundColor
{
get => ThemeManager.GetResourceColor("BackgroundColor").ToUIColor();
get => ThemeManager.GetResourceColor("BackgroundColor").ToPlatform();
}
public static UIColor MutedColor
{
get => ThemeManager.GetResourceColor("MutedColor").ToUIColor();
get => ThemeManager.GetResourceColor("MutedColor").ToPlatform();
}
public static UIColor SuccessColor
{
get => ThemeManager.GetResourceColor("SuccessColor").ToUIColor();
get => ThemeManager.GetResourceColor("SuccessColor").ToPlatform();
}
public static UIColor DangerColor
{
get => ThemeManager.GetResourceColor("DangerColor").ToUIColor();
get => ThemeManager.GetResourceColor("DangerColor").ToPlatform();
}
public static UIColor PrimaryColor
{
get => ThemeManager.GetResourceColor("PrimaryColor").ToUIColor();
get => ThemeManager.GetResourceColor("PrimaryColor").ToPlatform();
}
public static UIColor TextColor
{
get => ThemeManager.GetResourceColor("TextColor").ToUIColor();
get => ThemeManager.GetResourceColor("TextColor").ToPlatform();
}
public static UIColor SeparatorColor
{
get => ThemeManager.GetResourceColor("SeparatorColor").ToUIColor();
get => ThemeManager.GetResourceColor("SeparatorColor").ToPlatform();
}
public static UIColor ListHeaderBackgroundColor
{
get => ThemeManager.GetResourceColor("ListHeaderBackgroundColor").ToUIColor();
get => ThemeManager.GetResourceColor("ListHeaderBackgroundColor").ToPlatform();
}
public static UIColor NavBarBackgroundColor
{
get => ThemeManager.GetResourceColor("NavigationBarBackgroundColor").ToUIColor();
get => ThemeManager.GetResourceColor("NavigationBarBackgroundColor").ToPlatform();
}
public static UIColor NavBarTextColor
{
get => ThemeManager.GetResourceColor("NavigationBarTextColor").ToUIColor();
get => ThemeManager.GetResourceColor("NavigationBarTextColor").ToPlatform();
}
public static UIColor TabBarBackgroundColor
{
get => ThemeManager.GetResourceColor("TabBarBackgroundColor").ToUIColor();
get => ThemeManager.GetResourceColor("TabBarBackgroundColor").ToPlatform();
}
public static UIColor TabBarItemColor
{
get => ThemeManager.GetResourceColor("TabBarItemColor").ToUIColor();
get => ThemeManager.GetResourceColor("TabBarItemColor").ToPlatform();
}
public static void SetAppearance(string theme, bool osDarkModeEnabled)
@@ -75,8 +75,7 @@ namespace Bit.iOS.Core.Utilities
public static UIFont GetDangerFont()
{
// TODO: [MAUI-Migration] [Deprecated] NamedSizes are deprecated on MAUI
return Microsoft.Maui.Font.SystemFontOfSize(Device.GetNamedSize(NamedSize.Small, typeof(UILabel)), FontWeight.Bold).ToUIFont();
return Microsoft.Maui.Font.SystemFontOfSize(14, FontWeight.Bold).ToUIFont();
}
private static void SetThemeVariables(string theme, bool osDarkModeEnabled)