Skip to content

Commit

Permalink
[AVFoundation] Adjust availability attributes according to conditiona…
Browse files Browse the repository at this point in the history
…l compilation directives. (#17311)

According to the compilation compilation directives, these APIs are not
available on tvOS nor macOS, so update the availability attributes
accordingly.
  • Loading branch information
rolfbjarne authored Jan 20, 2023
1 parent 3294a49 commit 6ba4824
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
35 changes: 21 additions & 14 deletions src/AVFoundation/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -418,11 +421,12 @@ public event EventHandler<AVCategoryEventArgs> 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
Expand All @@ -437,11 +441,12 @@ public event EventHandler<AVStatusEventArgs> 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
Expand All @@ -457,11 +462,12 @@ public event EventHandler<AVSampleRateEventArgs> 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
Expand All @@ -477,11 +483,12 @@ public event EventHandler<AVChannelsEventArgs> 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
Expand Down
7 changes: 0 additions & 7 deletions tests/cecil-tests/ApiAvailabilityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.AVCategoryEventArgs> AVFoundation.AVAudioSession::CategoryChanged (event)",
"System.EventHandler`1<AVFoundation.AVChannelsEventArgs> AVFoundation.AVAudioSession::InputChannelsChanged (event)",
"System.EventHandler`1<AVFoundation.AVChannelsEventArgs> AVFoundation.AVAudioSession::OutputChannelsChanged (event)",
"System.EventHandler`1<AVFoundation.AVSampleRateEventArgs> AVFoundation.AVAudioSession::SampleRateChanged (event)",
"System.EventHandler`1<AVFoundation.AVStatusEventArgs> AVFoundation.AVAudioSession::InputAvailabilityChanged (event)",
"System.String PassKit.PKAddShareablePassConfiguration::ProvisioningPolicyIdentifier()",
"System.String PassKit.PKShareablePassMetadata::LocalizedDescription()",
"System.String PassKit.PKShareablePassMetadata::OwnerDisplayName()",
Expand Down

4 comments on commit 6ba4824

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.