From dc929a5e7ba07dc2de0cdab819e4e551b6c8a816 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 22 Nov 2021 08:09:47 +0100 Subject: [PATCH] [AudioComponent] Remove deprecated API from .NET, and adjust/add a few availability attributes for other API. (#13373) * [AudioComponent] Remove deprecated API from .NET, and adjust/add a few availability attributes for other API. * Add back obsolete attributes. --- src/AudioUnit/AudioComponent.cs | 44 ++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/src/AudioUnit/AudioComponent.cs b/src/AudioUnit/AudioComponent.cs index 70bd06373a..341e73edd2 100644 --- a/src/AudioUnit/AudioComponent.cs +++ b/src/AudioUnit/AudioComponent.cs @@ -52,7 +52,7 @@ namespace AudioUnit #if !COREBUILD -#if (!WATCH && !TVOS) || ((WATCH || TVOS) && !XAMCORE_4_0) +#if (!WATCH && !TVOS) || ((WATCH || TVOS) && !NET) // keys are not constants and had to be found in AudioToolbox.framework/Headers/AudioComponent.h #if !NET @@ -60,12 +60,8 @@ namespace AudioUnit #else [SupportedOSPlatform ("ios11.0")] #endif -#if ((WATCH || TVOS) && !XAMCORE_4_0) -#if !NET +#if ((WATCH || TVOS) && !NET) [Obsolete ("This API is not available on this platform.")] -#else - [UnsupportedOSPlatform ("tvos")] -#endif #endif public partial class ResourceUsageInfo : DictionaryContainer { static NSString userClientK = new NSString ("iokit.user-client"); @@ -126,12 +122,8 @@ namespace AudioUnit #else [SupportedOSPlatform ("ios11.0")] #endif -#if ((WATCH || TVOS) && !XAMCORE_4_0) -#if !NET +#if ((WATCH || TVOS) && !NET) [Obsolete ("This API is not available on this platform.")] -#else - [UnsupportedOSPlatform ("tvos")] -#endif #endif public partial class AudioComponentInfo : DictionaryContainer { static NSString typeK = new NSString ("type"); @@ -232,7 +224,7 @@ namespace AudioUnit } } } -#endif +#endif // (!WATCH && !TVOS) || ((WATCH || TVOS) && !NET) #endif // !COREBUILD @@ -373,8 +365,10 @@ namespace AudioUnit #if !NET [iOS (7,0)] [Deprecated (PlatformName.iOS, 14,0)] + [Deprecated (PlatformName.TvOS, 14,0)] #else [UnsupportedOSPlatform ("ios14.0")] + [UnsupportedOSPlatform ("tvos14.0")] #endif [DllImport(Constants.AudioUnitLibrary)] static extern IntPtr AudioComponentGetIcon (IntPtr comp, float /* float */ desiredPointSize); @@ -382,10 +376,14 @@ namespace AudioUnit #if !NET [iOS (7,0)] [Deprecated (PlatformName.iOS, 14,0, message: "Use 'CopyIcon' instead.")] + [Deprecated (PlatformName.TvOS, 14,0, message: "Use 'CopyIcon' instead.")] #else [UnsupportedOSPlatform ("ios14.0")] + [UnsupportedOSPlatform ("tvos14.0")] #if IOS [Obsolete ("Starting with ios14.0 use 'CopyIcon' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] +#elif __TVOS__ + [Obsolete ("Starting with tvos14.0 use 'CopyIcon' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif #endif public UIKit.UIImage? GetIcon (float desiredPointSize) @@ -397,10 +395,14 @@ namespace AudioUnit #if !NET [iOS (7,0)] [Deprecated (PlatformName.iOS, 13,0)] + [Deprecated (PlatformName.TvOS, 13,0)] [MacCatalyst (14,0)] + [Deprecated (PlatformName.MacCatalyst, 14,0)] #else [UnsupportedOSPlatform ("ios13.0")] + [UnsupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("maccatalyst14.0")] + [UnsupportedOSPlatform ("maccatalyst14.0")] #endif [DllImport(Constants.AudioUnitLibrary)] static extern double AudioComponentGetLastActiveTime (IntPtr comp); @@ -408,15 +410,19 @@ namespace AudioUnit #if !NET [iOS (7,0)] [Deprecated (PlatformName.iOS, 13,0, message: "Use 'AudioUnit' instead.")] + [Deprecated (PlatformName.TvOS, 13,0, message: "Use 'AudioUnit' instead.")] [MacCatalyst (14,0)][Deprecated (PlatformName.MacCatalyst, 14,0, message: "Use 'AudioUnit' instead.")] #else [SupportedOSPlatform ("maccatalyst14.0")] [UnsupportedOSPlatform ("ios13.0")] + [UnsupportedOSPlatform ("tvos13.0")] [UnsupportedOSPlatform ("maccatalyst14.0")] -#if IOS - [Obsolete ("Starting with ios13.0 use 'AudioUnit' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] -#elif __MACCATALYST__ +#if __MACCATALYST__ [Obsolete ("Starting with maccatalyst14.0 use 'AudioUnit' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] +#elif IOS + [Obsolete ("Starting with ios13.0 use 'AudioUnit' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] +#elif __TVOS__ + [Obsolete ("Starting with tvos13.0 use 'AudioUnit' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif #endif public double LastActiveTime { @@ -428,12 +434,20 @@ namespace AudioUnit // extern NSImage * __nullable AudioComponentGetIcon (AudioComponent __nonnull comp) __attribute__((availability(macosx, introduced=10.11))); #if !NET [Mac (10,11)] + [Deprecated (PlatformName.MacOSX, 11, 0)] +#else + [SupportedOSPlatform ("macos10.11")] + [UnsupportedOSPlatform ("macos11.0")] #endif [DllImport (Constants.AudioUnitLibrary)] static extern IntPtr AudioComponentGetIcon (IntPtr comp); #if !NET [Mac (10,11)] + [Deprecated (PlatformName.MacOSX, 11, 0)] +#else + [SupportedOSPlatform ("macos10.11")] + [UnsupportedOSPlatform ("macos11.0")] #endif public AppKit.NSImage? GetIcon () {