From 6dbd41a7ea0443c5ac74549bbe7783866a824029 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Jan 2023 09:34:21 +0100 Subject: [PATCH] [AVFoundation] Adjust availability attributes according to conditional compilation directives. According to the compilation compilation directives, these APIs are not available on tvOS nor macOS, so update the availability attributes accordingly. --- src/AVFoundation/Events.cs | 35 ++++++++++++++---------- tests/cecil-tests/ApiAvailabilityTest.cs | 7 ----- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/AVFoundation/Events.cs b/src/AVFoundation/Events.cs index 4804cb674d63..0b1f85719fd3 100644 --- a/src/AVFoundation/Events.cs +++ b/src/AVFoundation/Events.cs @@ -361,11 +361,12 @@ InternalAVAudioSessionDelegate EnsureEventDelegate () } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #endif @@ -380,11 +381,12 @@ public event EventHandler BeginInterruption { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #endif @@ -399,11 +401,12 @@ public event EventHandler EndInterruption { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -418,11 +421,12 @@ public event EventHandler CategoryChanged { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -437,11 +441,12 @@ public event EventHandler InputAvailabilityChanged { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -457,11 +462,12 @@ public event EventHandler SampleRateChanged { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -477,11 +483,12 @@ public event EventHandler InputChannelsChanged { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif diff --git a/tests/cecil-tests/ApiAvailabilityTest.cs b/tests/cecil-tests/ApiAvailabilityTest.cs index 938978a5c180..9802be083dec 100644 --- a/tests/cecil-tests/ApiAvailabilityTest.cs +++ b/tests/cecil-tests/ApiAvailabilityTest.cs @@ -315,13 +315,6 @@ public void FindMissingObsoleteAttributes () "System.Boolean Security.SecRecord::UseNoAuthenticationUI()", "System.Double Speech.SFTranscription::AveragePauseDuration()", "System.Double Speech.SFTranscription::SpeakingRate()", - "System.EventHandler AVFoundation.AVAudioSession::BeginInterruption (event)", - "System.EventHandler AVFoundation.AVAudioSession::EndInterruption (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::CategoryChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::InputChannelsChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::OutputChannelsChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::SampleRateChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::InputAvailabilityChanged (event)", "System.String PassKit.PKAddShareablePassConfiguration::ProvisioningPolicyIdentifier()", "System.String PassKit.PKShareablePassMetadata::LocalizedDescription()", "System.String PassKit.PKShareablePassMetadata::OwnerDisplayName()",