mirror of
https://github.com/bitwarden/mobile
synced 2025-12-31 23:53:25 +00:00
PM-3350 Fixed/Updated all MAUI-Migration TODOs
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
// TODO: [MAUI-Migration] Check if moving this to the main project works for extensions.
|
||||
|
||||
//using Bit.iOS.Core.Effects;
|
||||
//using UIKit;
|
||||
//using Xamarin.Forms;
|
||||
//using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
//[assembly: ResolutionGroupName("Bitwarden")]
|
||||
//[assembly: ExportEffect(typeof(ScrollEnabledEffect), "ScrollEnabledEffect")]
|
||||
//namespace Bit.iOS.Core.Effects
|
||||
//{
|
||||
// public class ScrollEnabledEffect : PlatformEffect
|
||||
// {
|
||||
// protected override void OnAttached()
|
||||
// {
|
||||
// // this can be for any view that inherits from UIScrollView like UITextView.
|
||||
// if (Element != null && Control is UIScrollView scrollView)
|
||||
// {
|
||||
// scrollView.ScrollEnabled = App.Effects.ScrollEnabledEffect.GetIsScrollEnabled(Element);
|
||||
// }
|
||||
// }
|
||||
|
||||
// protected override void OnDetached()
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,39 +0,0 @@
|
||||
// TODO: [MAUI-Migration] Check if moving this to the main project works for extensions.
|
||||
|
||||
//using Bit.iOS.Core.Effects;
|
||||
//using UIKit;
|
||||
//using Xamarin.Forms;
|
||||
//using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
//[assembly: ExportEffect(typeof(ScrollViewContentInsetAdjustmentBehaviorEffect), nameof(ScrollViewContentInsetAdjustmentBehaviorEffect))]
|
||||
//namespace Bit.iOS.Core.Effects
|
||||
//{
|
||||
// public class ScrollViewContentInsetAdjustmentBehaviorEffect : PlatformEffect
|
||||
// {
|
||||
// protected override void OnAttached()
|
||||
// {
|
||||
// if (Element != null && Control is UIScrollView scrollView)
|
||||
// {
|
||||
// switch (App.Effects.ScrollViewContentInsetAdjustmentBehaviorEffect.GetContentInsetAdjustmentBehavior(Element))
|
||||
// {
|
||||
// case App.Effects.ScrollContentInsetAdjustmentBehavior.Automatic:
|
||||
// scrollView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Automatic;
|
||||
// break;
|
||||
// case App.Effects.ScrollContentInsetAdjustmentBehavior.ScrollableAxes:
|
||||
// scrollView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.ScrollableAxes;
|
||||
// break;
|
||||
// case App.Effects.ScrollContentInsetAdjustmentBehavior.Never:
|
||||
// scrollView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Never;
|
||||
// break;
|
||||
// case App.Effects.ScrollContentInsetAdjustmentBehavior.Always:
|
||||
// scrollView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Always;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// protected override void OnDetached()
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user