Skip to content

Commit

Permalink
Prepare for NET6 attribute conversion with hand fixes
Browse files Browse the repository at this point in the history
- 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 xamarin#10170
  • Loading branch information
chamons committed Jan 6, 2022
1 parent 165924f commit 809d7b0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 50 deletions.
18 changes: 0 additions & 18 deletions src/AVKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
30 changes: 0 additions & 30 deletions src/Foundation/Enum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
20 changes: 18 additions & 2 deletions src/avkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -940,4 +938,22 @@ interface AVPlayerViewDelegate
void RestoreUserInterfaceForFullScreenExit (AVPlayerView playerView, Action<bool> 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
}

}
28 changes: 28 additions & 0 deletions src/foundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 809d7b0

Please sign in to comment.