From 809d7b0ee1199b8a26a404e267d74ae1dba3adc0 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 6 Jan 2022 15:08:04 -0600 Subject: [PATCH] Prepare for NET6 attribute conversion with hand fixes - The tool I wrote to convert attributes [mellite](https://github.com/chamons/mellite) does single pass through each file - This means files that define Foo and !Foo, each with availability attributes inside can not be proccessed - These 2 locations were easy to fix by moving defines inside binding definations, so I did that - About 10 other locations were not so easy, so those will be worked around by hand in the conversion process. Part of https://github.com/xamarin/xamarin-macios/issues/10170 --- src/AVKit/Enums.cs | 18 ------------------ src/Foundation/Enum.cs | 30 ------------------------------ src/avkit.cs | 20 ++++++++++++++++++-- src/foundation.cs | 28 ++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 50 deletions(-) diff --git a/src/AVKit/Enums.cs b/src/AVKit/Enums.cs index de84f84f699d..20a66658be9e 100644 --- a/src/AVKit/Enums.cs +++ b/src/AVKit/Enums.cs @@ -17,24 +17,6 @@ public enum AVPlayerViewControlsStyle : long { } #endif -#if MONOMAC - [Mac (10,10)] - [Native] - public enum AVCaptureViewControlsStyle : long { - Inline, - Floating, - InlineDeviceSelection, - Default = Inline, - } - - [Mac (10,9)] - [Native] - public enum AVPlayerViewTrimResult : long { - OKButton, - CancelButton - } -#endif - #if !MONOMAC || !XAMCORE_4_0 [iOS (9,0)] [TV (13,0)] diff --git a/src/Foundation/Enum.cs b/src/Foundation/Enum.cs index 1252820209c9..51fad7173d86 100644 --- a/src/Foundation/Enum.cs +++ b/src/Foundation/Enum.cs @@ -498,25 +498,6 @@ public enum NSEnumerationOptions : ulong { Reverse = 2 } -#if MONOMAC || __MACCATALYST__ - [MacCatalyst(15, 0)] - [Native] - public enum NSNotificationSuspensionBehavior : ulong { - Drop = 1, - Coalesce = 2, - Hold = 3, - DeliverImmediately = 4, - } - - [MacCatalyst(15, 0)] - [Flags] - [Native] - public enum NSNotificationFlags : ulong { - DeliverImmediately = (1 << 0), - PostToAllSessions = (1 << 1), - } -#endif - [Flags] [Native] public enum NSStreamEvent : ulong { @@ -1269,17 +1250,6 @@ public enum NSPersonNameComponentsFormatterStyle : long Abbreviated } -#if MONOMAC - [Mac (10,11)][NoWatch][NoTV][NoiOS] - [Native] - [Flags] - public enum NSFileManagerUnmountOptions : ulong - { - AllPartitionsAndEjectDisk = 1 << 0, - WithoutUI = 1 << 1 - } -#endif - [iOS (9,0)][Mac (10,11)] [Native] public enum NSDecodingFailurePolicy : long { diff --git a/src/avkit.cs b/src/avkit.cs index 705f2789b98b..f8d86bfe91c2 100644 --- a/src/avkit.cs +++ b/src/avkit.cs @@ -14,9 +14,7 @@ using OpenGLES; #endif #if !MONOMAC -using AVCaptureViewControlsStyle = Foundation.NSObject; using AVPlayerViewControlsStyle = Foundation.NSObject; -using AVPlayerViewTrimResult = Foundation.NSObject; using NSColor = UIKit.UIColor; using NSMenu = Foundation.NSObject; using NSView = UIKit.UIView; @@ -940,4 +938,22 @@ interface AVPlayerViewDelegate void RestoreUserInterfaceForFullScreenExit (AVPlayerView playerView, Action completionHandler); } + [Mac (10,10)] + [NoiOS][NoTV][NoWatch][NoMacCatalyst] + [Native] + public enum AVCaptureViewControlsStyle : long { + Inline, + Floating, + InlineDeviceSelection, + Default = Inline, + } + + [Mac (10,9)] + [NoiOS][NoTV][NoWatch][NoMacCatalyst] + [Native] + public enum AVPlayerViewTrimResult : long { + OKButton, + CancelButton + } + } diff --git a/src/foundation.cs b/src/foundation.cs index 1796a8b236e9..1cf22269532d 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -16473,4 +16473,32 @@ public enum NSUrlSessionTaskMetricsDomainResolutionProtocol : long { Tls, Https, } + + [NoiOS][NoTV][NoWatch] + [MacCatalyst(15, 0)] + [Native] + public enum NSNotificationSuspensionBehavior : ulong { + Drop = 1, + Coalesce = 2, + Hold = 3, + DeliverImmediately = 4, + } + + [NoiOS][NoTV][NoWatch] + [MacCatalyst(15, 0)] + [Flags] + [Native] + public enum NSNotificationFlags : ulong { + DeliverImmediately = (1 << 0), + PostToAllSessions = (1 << 1), + } + + [Mac (10,11)][NoWatch][NoTV][NoiOS][NoMacCatalyst] + [Native] + [Flags] + public enum NSFileManagerUnmountOptions : ulong + { + AllPartitionsAndEjectDisk = 1 << 0, + WithoutUI = 1 << 1 + } }