Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore menu code pre iOS13 #6205

Merged
merged 1 commit into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Core/src/Handlers/MenuBar/MenuBarHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public override void SetVirtualView(IElement view)

void BuildNewMenu()
{
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

UIMenu? lastFoundMenu = null;
foreach (var item in VirtualView)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ internal static void Execute(UICommand uICommand)

internal static void Reset()
{
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

menus.Clear();
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/Core/src/Handlers/Window/WindowHandler.iOS.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using ObjCRuntime;
using UIKit;

Expand All @@ -22,6 +22,9 @@ public static void MapContent(IWindowHandler handler, IWindow window)

public static void MapMenuBar(IWindowHandler handler, IWindow view)
{
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

if (MauiUIApplicationDelegate.Current != null &&
view is IMenuBarElement mb)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public override void BuildMenu(IUIMenuBuilder builder)

base.BuildMenu(builder);

if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

MenuBuilder = builder;

var window = Window ?? this.GetWindow() ??
Expand Down
3 changes: 3 additions & 0 deletions src/Core/src/Platform/iOS/MenuExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ internal static UIMenu ToPlatformMenu(
IMauiContext mauiContext,
IUIMenuBuilder? uIMenuBuilder)
{
if (String.IsNullOrWhiteSpace(title))
throw new ArgumentNullException(nameof(title), $"{menuElements} requires title text.");

uIMenuBuilder = uIMenuBuilder ??
MauiUIApplicationDelegate.Current.MenuBuilder!;

Expand Down