Skip to content

Commit 733f6a6

Browse files
Tamilarasan-Paranthamanjfversluis
authored andcommitted
CA1416 warning changes
1 parent 1245701 commit 733f6a6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public override void BuildMenu(IUIMenuBuilder builder)
3030

3131
UIWindow? window = null;
3232

33-
if (OperatingSystem.IsMacCatalystVersionAtLeast(14))
33+
if (OperatingSystem.IsMacCatalystVersionAtLeast(14) || OperatingSystem.IsIOSVersionAtLeast(14))
3434
{
3535
// for iOS 14+ where active apperance is supported
3636
var activeWindowScenes = new List<UIWindowScene>();
@@ -60,10 +60,18 @@ public override void BuildMenu(IUIMenuBuilder builder)
6060
}
6161
}
6262
}
63-
else
63+
else if (OperatingSystem.IsMacCatalystVersionAtLeast(15) || OperatingSystem.IsIOSVersionAtLeast(15))
6464
{
6565
window = activeWindowScenes[0].KeyWindow;
6666
}
67+
else if (activeWindowScenes[0].Windows.Length > 0)
68+
{
69+
window = activeWindowScenes[0].Windows[0];
70+
}
71+
else
72+
{
73+
window = Window ?? this.GetWindow() ?? UIApplication.SharedApplication.GetWindow()?.Handler?.PlatformView as UIWindow;
74+
}
6775
}
6876
}
6977
else

0 commit comments

Comments
 (0)