[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.
This commit is contained in:
Rolf Bjarne Kvinge 2021-11-22 08:09:47 +01:00 коммит произвёл GitHub
Родитель 406c2e2378
Коммит dc929a5e7b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 29 добавлений и 15 удалений

Просмотреть файл

@ -52,7 +52,7 @@ namespace AudioUnit
#if !COREBUILD #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 // keys are not constants and had to be found in AudioToolbox.framework/Headers/AudioComponent.h
#if !NET #if !NET
@ -60,12 +60,8 @@ namespace AudioUnit
#else #else
[SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("ios11.0")]
#endif #endif
#if ((WATCH || TVOS) && !XAMCORE_4_0) #if ((WATCH || TVOS) && !NET)
#if !NET
[Obsolete ("This API is not available on this platform.")] [Obsolete ("This API is not available on this platform.")]
#else
[UnsupportedOSPlatform ("tvos")]
#endif
#endif #endif
public partial class ResourceUsageInfo : DictionaryContainer { public partial class ResourceUsageInfo : DictionaryContainer {
static NSString userClientK = new NSString ("iokit.user-client"); static NSString userClientK = new NSString ("iokit.user-client");
@ -126,12 +122,8 @@ namespace AudioUnit
#else #else
[SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("ios11.0")]
#endif #endif
#if ((WATCH || TVOS) && !XAMCORE_4_0) #if ((WATCH || TVOS) && !NET)
#if !NET
[Obsolete ("This API is not available on this platform.")] [Obsolete ("This API is not available on this platform.")]
#else
[UnsupportedOSPlatform ("tvos")]
#endif
#endif #endif
public partial class AudioComponentInfo : DictionaryContainer { public partial class AudioComponentInfo : DictionaryContainer {
static NSString typeK = new NSString ("type"); static NSString typeK = new NSString ("type");
@ -232,7 +224,7 @@ namespace AudioUnit
} }
} }
} }
#endif #endif // (!WATCH && !TVOS) || ((WATCH || TVOS) && !NET)
#endif // !COREBUILD #endif // !COREBUILD
@ -373,8 +365,10 @@ namespace AudioUnit
#if !NET #if !NET
[iOS (7,0)] [iOS (7,0)]
[Deprecated (PlatformName.iOS, 14,0)] [Deprecated (PlatformName.iOS, 14,0)]
[Deprecated (PlatformName.TvOS, 14,0)]
#else #else
[UnsupportedOSPlatform ("ios14.0")] [UnsupportedOSPlatform ("ios14.0")]
[UnsupportedOSPlatform ("tvos14.0")]
#endif #endif
[DllImport(Constants.AudioUnitLibrary)] [DllImport(Constants.AudioUnitLibrary)]
static extern IntPtr AudioComponentGetIcon (IntPtr comp, float /* float */ desiredPointSize); static extern IntPtr AudioComponentGetIcon (IntPtr comp, float /* float */ desiredPointSize);
@ -382,10 +376,14 @@ namespace AudioUnit
#if !NET #if !NET
[iOS (7,0)] [iOS (7,0)]
[Deprecated (PlatformName.iOS, 14,0, message: "Use 'CopyIcon' instead.")] [Deprecated (PlatformName.iOS, 14,0, message: "Use 'CopyIcon' instead.")]
[Deprecated (PlatformName.TvOS, 14,0, message: "Use 'CopyIcon' instead.")]
#else #else
[UnsupportedOSPlatform ("ios14.0")] [UnsupportedOSPlatform ("ios14.0")]
[UnsupportedOSPlatform ("tvos14.0")]
#if IOS #if IOS
[Obsolete ("Starting with ios14.0 use 'CopyIcon' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] [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
#endif #endif
public UIKit.UIImage? GetIcon (float desiredPointSize) public UIKit.UIImage? GetIcon (float desiredPointSize)
@ -397,10 +395,14 @@ namespace AudioUnit
#if !NET #if !NET
[iOS (7,0)] [iOS (7,0)]
[Deprecated (PlatformName.iOS, 13,0)] [Deprecated (PlatformName.iOS, 13,0)]
[Deprecated (PlatformName.TvOS, 13,0)]
[MacCatalyst (14,0)] [MacCatalyst (14,0)]
[Deprecated (PlatformName.MacCatalyst, 14,0)]
#else #else
[UnsupportedOSPlatform ("ios13.0")] [UnsupportedOSPlatform ("ios13.0")]
[UnsupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("maccatalyst14.0")] [SupportedOSPlatform ("maccatalyst14.0")]
[UnsupportedOSPlatform ("maccatalyst14.0")]
#endif #endif
[DllImport(Constants.AudioUnitLibrary)] [DllImport(Constants.AudioUnitLibrary)]
static extern double AudioComponentGetLastActiveTime (IntPtr comp); static extern double AudioComponentGetLastActiveTime (IntPtr comp);
@ -408,15 +410,19 @@ namespace AudioUnit
#if !NET #if !NET
[iOS (7,0)] [iOS (7,0)]
[Deprecated (PlatformName.iOS, 13,0, message: "Use 'AudioUnit' instead.")] [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.")] [MacCatalyst (14,0)][Deprecated (PlatformName.MacCatalyst, 14,0, message: "Use 'AudioUnit' instead.")]
#else #else
[SupportedOSPlatform ("maccatalyst14.0")] [SupportedOSPlatform ("maccatalyst14.0")]
[UnsupportedOSPlatform ("ios13.0")] [UnsupportedOSPlatform ("ios13.0")]
[UnsupportedOSPlatform ("tvos13.0")]
[UnsupportedOSPlatform ("maccatalyst14.0")] [UnsupportedOSPlatform ("maccatalyst14.0")]
#if IOS #if __MACCATALYST__
[Obsolete ("Starting with ios13.0 use 'AudioUnit' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
#elif __MACCATALYST__
[Obsolete ("Starting with maccatalyst14.0 use 'AudioUnit' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] [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
#endif #endif
public double LastActiveTime { public double LastActiveTime {
@ -428,12 +434,20 @@ namespace AudioUnit
// extern NSImage * __nullable AudioComponentGetIcon (AudioComponent __nonnull comp) __attribute__((availability(macosx, introduced=10.11))); // extern NSImage * __nullable AudioComponentGetIcon (AudioComponent __nonnull comp) __attribute__((availability(macosx, introduced=10.11)));
#if !NET #if !NET
[Mac (10,11)] [Mac (10,11)]
[Deprecated (PlatformName.MacOSX, 11, 0)]
#else
[SupportedOSPlatform ("macos10.11")]
[UnsupportedOSPlatform ("macos11.0")]
#endif #endif
[DllImport (Constants.AudioUnitLibrary)] [DllImport (Constants.AudioUnitLibrary)]
static extern IntPtr AudioComponentGetIcon (IntPtr comp); static extern IntPtr AudioComponentGetIcon (IntPtr comp);
#if !NET #if !NET
[Mac (10,11)] [Mac (10,11)]
[Deprecated (PlatformName.MacOSX, 11, 0)]
#else
[SupportedOSPlatform ("macos10.11")]
[UnsupportedOSPlatform ("macos11.0")]
#endif #endif
public AppKit.NSImage? GetIcon () public AppKit.NSImage? GetIcon ()
{ {