From 2a4b97c484ec3ea39825c56ca6b549428869c518 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 2 Aug 2023 08:34:24 -0400 Subject: [PATCH 1/5] [UIKit] Fix UIKit selector on TvOS This API was missed because the old sim intro tests are not running and we missed it. This was found while working on xcode15. The tvOS attr is missing which defaults to the min version of tvOS when it should be 15. Added a compat implementation so that the API remains. --- src/UIKit/UIMenu.cs | 28 ++++++++++++++++++++++++++++ src/frameworks.sources | 1 + src/uikit.cs | 7 ++++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/UIKit/UIMenu.cs diff --git a/src/UIKit/UIMenu.cs b/src/UIKit/UIMenu.cs new file mode 100644 index 000000000000..a6d2382c155f --- /dev/null +++ b/src/UIKit/UIMenu.cs @@ -0,0 +1,28 @@ +#if !WATCH +using System; +using ObjCRuntime; +using Foundation; + +namespace UIKit { + public partial class UIMenu { +#if !XAMCORE_5_0 + + public virtual UIMenuElement [] SelectedElements { + get { + // check if we are on tvos earlier than 15, if so, return and empty array, else return + // the correct value +#if TVOS + if (SystemVersion.ChecktvOS (15, 0)) { + return _SelectedElements; + } else { + return Array.Empty (); + } +#else + return _SelectedElements; +#endif + } +#endif + } + } +} +#endif diff --git a/src/frameworks.sources b/src/frameworks.sources index 0f8fa7306c7e..86084a10847e 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -1741,6 +1741,7 @@ UIKIT_SOURCES = \ UIKit/UIKeyboard.cs \ UIKit/UIKitSynchronizationContext.cs \ UIKit/UIListSeparatorConfiguration.cs \ + UIKit/UIMenu.cs \ UIKit/UINavigationBar.cs \ UIKit/UINavigationController.cs \ UIKit/UIPageViewController.cs \ diff --git a/src/uikit.cs b/src/uikit.cs index 902a7c7d798b..3c82f4063c46 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -9157,9 +9157,14 @@ interface UIMenu { [Export ("options")] UIMenuOptions Options { get; } - [iOS (15, 0), MacCatalyst (15, 0)] + [iOS (15, 0), MacCatalyst (15, 0), TV (15, 0)] [Export ("selectedElements")] +#if XAMCORE_5_0 UIMenuElement [] SelectedElements { get; } +#else + [Internal] + UIMenuElement [] _SelectedElements { get; } +#endif [Export ("children")] UIMenuElement [] Children { get; } From 5f61a05de2b03ef77eea1e35b6d6bab08950df30 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 2 Aug 2023 08:41:11 -0400 Subject: [PATCH 2/5] Add missing attrs. --- src/UIKit/UIMenu.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/UIKit/UIMenu.cs b/src/UIKit/UIMenu.cs index a6d2382c155f..38094a5038d3 100644 --- a/src/UIKit/UIMenu.cs +++ b/src/UIKit/UIMenu.cs @@ -1,5 +1,7 @@ #if !WATCH using System; +using System.Runtime.InteropServices; + using ObjCRuntime; using Foundation; @@ -7,6 +9,13 @@ namespace UIKit { public partial class UIMenu { #if !XAMCORE_5_0 +#if NET + [SupportedOSPlatform ("tvos13.0")] + [SupportedOSPlatform ("ios15.0")] + [SupportedOSPlatform ("maccatalyst15.0")] +#else + [iOS (15, 0)] +#endif public virtual UIMenuElement [] SelectedElements { get { // check if we are on tvos earlier than 15, if so, return and empty array, else return From 344e06a9fa893f4e9575e1bd0f4f80defc4ecc91 Mon Sep 17 00:00:00 2001 From: GitHub Actions Autoformatter Date: Wed, 2 Aug 2023 12:45:18 +0000 Subject: [PATCH 3/5] Auto-format source code --- src/UIKit/UIMenu.cs | 2 +- src/uikit.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UIKit/UIMenu.cs b/src/UIKit/UIMenu.cs index 38094a5038d3..c60c6227589f 100644 --- a/src/UIKit/UIMenu.cs +++ b/src/UIKit/UIMenu.cs @@ -16,7 +16,7 @@ public partial class UIMenu { #else [iOS (15, 0)] #endif - public virtual UIMenuElement [] SelectedElements { + public virtual UIMenuElement [] SelectedElements { get { // check if we are on tvos earlier than 15, if so, return and empty array, else return // the correct value diff --git a/src/uikit.cs b/src/uikit.cs index 3c82f4063c46..899117a9f376 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -9161,7 +9161,7 @@ interface UIMenu { [Export ("selectedElements")] #if XAMCORE_5_0 UIMenuElement [] SelectedElements { get; } -#else +#else [Internal] UIMenuElement [] _SelectedElements { get; } #endif From b66860fb0a630fee8d2085f343d3e072eac473b5 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 2 Aug 2023 09:02:28 -0400 Subject: [PATCH 4/5] Update src/UIKit/UIMenu.cs Co-authored-by: Rolf Bjarne Kvinge --- src/UIKit/UIMenu.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UIKit/UIMenu.cs b/src/UIKit/UIMenu.cs index c60c6227589f..b9c149123f4d 100644 --- a/src/UIKit/UIMenu.cs +++ b/src/UIKit/UIMenu.cs @@ -10,7 +10,7 @@ public partial class UIMenu { #if !XAMCORE_5_0 #if NET - [SupportedOSPlatform ("tvos13.0")] + [SupportedOSPlatform ("tvos15.0")] [SupportedOSPlatform ("ios15.0")] [SupportedOSPlatform ("maccatalyst15.0")] #else From 9464ba478780a2e565602965bd0c7b626e36b21c Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 2 Aug 2023 09:02:46 -0400 Subject: [PATCH 5/5] Update src/UIKit/UIMenu.cs Co-authored-by: Rolf Bjarne Kvinge --- src/UIKit/UIMenu.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/UIKit/UIMenu.cs b/src/UIKit/UIMenu.cs index b9c149123f4d..4b2c58108880 100644 --- a/src/UIKit/UIMenu.cs +++ b/src/UIKit/UIMenu.cs @@ -15,6 +15,7 @@ public partial class UIMenu { [SupportedOSPlatform ("maccatalyst15.0")] #else [iOS (15, 0)] + [TV (15,0)] #endif public virtual UIMenuElement [] SelectedElements { get {