From cba2d269b920e342296866ee99b36dbe24269a70 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 23 Nov 2020 14:46:11 +0100 Subject: [PATCH] [src] API tweaks for Mac Catalyst --- src/MediaPlayer/MediaPlayer.cs | 1 + src/Metal/MTLEnums.cs | 6 +++--- .../VSAccountMetadataRequest.cs | 1 + .../VSAccountProviderAuthenticationScheme.cs | 2 ++ src/fileprovider.cs | 16 ++++++++-------- src/metal.cs | 2 -- src/scenekit.cs | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/MediaPlayer/MediaPlayer.cs b/src/MediaPlayer/MediaPlayer.cs index 0b3fd84f6c..bd8c021139 100644 --- a/src/MediaPlayer/MediaPlayer.cs +++ b/src/MediaPlayer/MediaPlayer.cs @@ -345,6 +345,7 @@ namespace MediaPlayer { [Watch (5,0)] [iOS (11, 0)] [TV (11, 0)] + [MacCatalyst (13, 0)] [Native] public enum MPNowPlayingPlaybackState : ulong { diff --git a/src/Metal/MTLEnums.cs b/src/Metal/MTLEnums.cs index 6ab1edcc5f..60f86182bb 100644 --- a/src/Metal/MTLEnums.cs +++ b/src/Metal/MTLEnums.cs @@ -1089,16 +1089,16 @@ namespace Metal { DepthResolvedSample = 1, } - [Unavailable (PlatformName.MacCatalyst)] + [Flags, Mac (11,0), NoTV, iOS (13,0)] - [Native, Advice ("This API is not available when using UIKit on macOS.")] + [Native] public enum MTLSparseTextureRegionAlignmentMode : ulong { Outward = 0x0, Inward = 0x1, } - [Unavailable (PlatformName.MacCatalyst)] [Flags, Mac (11,0), NoTV, iOS (13,0)] + [MacCatalyst (14, 0)] [Native, Advice ("This API is not available when using UIKit on macOS.")] public enum MTLSparseTextureMappingMode : ulong { Map = 0x0, diff --git a/src/VideoSubscriberAccount/VSAccountMetadataRequest.cs b/src/VideoSubscriberAccount/VSAccountMetadataRequest.cs index 3a4985ab65..289f04d0a2 100644 --- a/src/VideoSubscriberAccount/VSAccountMetadataRequest.cs +++ b/src/VideoSubscriberAccount/VSAccountMetadataRequest.cs @@ -1,3 +1,4 @@ +#if !__MACCATALYST__ using System; using System.Threading.Tasks; using ObjCRuntime; diff --git a/src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs b/src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs index f03cc9f9c1..49f7265efc 100644 --- a/src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs +++ b/src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs @@ -1,3 +1,4 @@ +#if !__MACCATALYST__ using System; using System.Threading.Tasks; using Foundation; @@ -31,3 +32,4 @@ namespace VideoSubscriberAccount { } } } +#endif // !__MACCATALYST__ diff --git a/src/fileprovider.cs b/src/fileprovider.cs index f3fac4b8fb..08e26ec7ed 100644 --- a/src/fileprovider.cs +++ b/src/fileprovider.cs @@ -15,7 +15,7 @@ using CoreGraphics; using Foundation; using UniformTypeIdentifiers; -#if IOS && !XAMCORE_4_0 +#if IOS && !XAMCORE_4_0 && !__MACCATALYST__ using FileProvider; // This is the original (iOS 8) location of `NSFileProviderExtension` @@ -215,7 +215,7 @@ namespace FileProvider { [iOS (11,0)] [Mac (11,0)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Static] interface NSFileProviderItemIdentifier { @@ -232,7 +232,7 @@ namespace FileProvider { [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Native] [Flags] enum NSFileProviderItemCapabilities : ulong { @@ -258,7 +258,7 @@ namespace FileProvider { [iOS (11,0)] [Mac (11,0)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Static] interface NSFileProviderPage { @@ -326,7 +326,7 @@ namespace FileProvider { [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Protocol] interface NSFileProviderEnumerationObserver { @@ -352,7 +352,7 @@ namespace FileProvider { [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Protocol] interface NSFileProviderChangeObserver { @@ -382,7 +382,7 @@ namespace FileProvider { [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Protocol] interface NSFileProviderEnumerator { @@ -405,7 +405,7 @@ namespace FileProvider { [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Protocol] interface NSFileProviderItem { diff --git a/src/metal.cs b/src/metal.cs index 60a722ef8b..90763319ad 100644 --- a/src/metal.cs +++ b/src/metal.cs @@ -1401,13 +1401,11 @@ namespace Metal { [Introduced (PlatformName.MacCatalyst, 14, 0)] [Mac (11,0), NoTV, iOS (13,0)] - [Advice ("This API is not available when using UIKit on macOS.")] [Export ("convertSparseTileRegions:toPixelRegions:withTileSize:numRegions:")] void ConvertSparseTileRegions (IntPtr tileRegions, IntPtr pixelRegions, MTLSize tileSize, nuint numRegions); [Introduced (PlatformName.MacCatalyst, 14, 0)] [Mac (11,0), NoTV, iOS (13,0)] - [Advice ("This API is not available when using UIKit on macOS.")] [Export ("convertSparsePixelRegions:toTileRegions:withTileSize:alignmentMode:numRegions:")] void ConvertSparsePixelRegions (IntPtr pixelRegions, IntPtr tileRegions, MTLSize tileSize, MTLSparseTextureRegionAlignmentMode mode, nuint numRegions); diff --git a/src/scenekit.cs b/src/scenekit.cs index 5423cd2435..c9b3323198 100644 --- a/src/scenekit.cs +++ b/src/scenekit.cs @@ -3444,7 +3444,7 @@ namespace SceneKit { [Deprecated (PlatformName.MacOSX, 10, 14, message: "Please use Metal instead of OpenGL API.")] [Export ("pixelFormat", ArgumentSemantic.Retain)] NSOpenGLPixelFormat PixelFormat { get; set; } -#elif !WATCH +#elif !WATCH && !__MACCATALYST__ [Deprecated (PlatformName.iOS, 12, 0, message: "Please use Metal instead of OpenGL API.")] [Deprecated (PlatformName.TvOS, 12, 0, message: "Please use Metal instead of OpenGL API.")] [Export ("eaglContext", ArgumentSemantic.Retain)]