From 2703cd466c9630882a5858f70ef27011d7ece456 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Tue, 22 Apr 2025 08:46:17 +0200 Subject: [PATCH] Remove Mac Catalyst version detection workaround --- .../Handlers/Shell/iOS/ShellItemRenderer.cs | 2 +- .../Shell/iOS/ShellPageRendererTracker.cs | 2 +- .../OperatingSystemMacCatalyst18Workaround.cs | 22 ------------------- .../src/Platform/iOS/TabbedViewExtensions.cs | 2 +- 4 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 src/Core/src/OperatingSystemMacCatalyst18Workaround.cs diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs index 5f3d9856398d..a55b024f926f 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs @@ -438,7 +438,7 @@ void UpdateTabBarHidden() if (ShellItemController == null) return; - if (OperatingSystemMacCatalyst18Workaround.IsMacCatalystVersionAtLeast18() || OperatingSystem.IsIOSVersionAtLeast(18)) + if (OperatingSystem.IsMacCatalystVersionAtLeast(18) || OperatingSystem.IsIOSVersionAtLeast(18)) { TabBarHidden = !ShellItemController.ShowTabs; } diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs index a1302223d7a5..b2c0d50d7fa1 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs @@ -141,7 +141,7 @@ protected virtual void UpdateTabBarVisible() var tabBarVisible = (Page.FindParentOfType() as IShellItemController)?.ShowTabs ?? Shell.GetTabBarIsVisible(Page); // In iOS 18, the tab bar visibility is effectively managed by the TabBarHidden property in ShellItemRenderer. - if (!(OperatingSystemMacCatalyst18Workaround.IsMacCatalystVersionAtLeast18() || OperatingSystem.IsIOSVersionAtLeast(18))) + if (!(OperatingSystem.IsMacCatalystVersionAtLeast(18) || OperatingSystem.IsIOSVersionAtLeast(18))) { ViewController.HidesBottomBarWhenPushed = !tabBarVisible; } diff --git a/src/Core/src/OperatingSystemMacCatalyst18Workaround.cs b/src/Core/src/OperatingSystemMacCatalyst18Workaround.cs deleted file mode 100644 index cb6239538398..000000000000 --- a/src/Core/src/OperatingSystemMacCatalyst18Workaround.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Microsoft.Maui.Platform -{ -#if PLATFORM - internal static partial class OperatingSystemMacCatalyst18Workaround - { - public static bool IsMacCatalystVersionAtLeast18() - { -#if !MACCATALYST - return false; -#else - // Delete all uses of this once this is merged - // /https://github.com/xamarin/xamarin-macios/issues/21390 - - - return Environment.OSVersion.Version.Major >= 18; -#endif - } - } -#endif -} \ No newline at end of file diff --git a/src/Core/src/Platform/iOS/TabbedViewExtensions.cs b/src/Core/src/Platform/iOS/TabbedViewExtensions.cs index 61be9c0dfc4b..3b176b5b8eb5 100644 --- a/src/Core/src/Platform/iOS/TabbedViewExtensions.cs +++ b/src/Core/src/Platform/iOS/TabbedViewExtensions.cs @@ -13,7 +13,7 @@ internal static class TabbedViewExtensions internal static void DisableiOS18ToolbarTabs(this UITabBarController tabBarController) { // Should apply to iOS and Catalyst - if (OperatingSystemMacCatalyst18Workaround.IsMacCatalystVersionAtLeast18()) //https://github.com/xamarin/xamarin-macios/issues/21390 + if (OperatingSystem.IsMacCatalystVersionAtLeast(18)) { tabBarController.TraitOverrides.HorizontalSizeClass = UIUserInterfaceSizeClass.Compact; tabBarController.Mode = UITabBarControllerMode.TabSidebar;