Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mediaplayer] Update for Xcode 12 beta 2 #9136

Merged
merged 1 commit into from
Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/MediaPlayer/MediaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public enum MPMovieTimeOption : long {

// NSUInteger -> MPMediaItem.h
[Native]
[NoWatch]
[Watch (7,0)]
[Flags]
public enum MPMediaType : ulong {
Music = 1 << 0,
Expand Down Expand Up @@ -301,7 +301,7 @@ public enum MPNowPlayingInfoLanguageOptionType : ulong {
}

[Mac (10,14,2)]
[NoWatch]
[Watch (7,0)]
[iOS (9,3)]
[Native]
[ErrorDomain ("MPErrorDomain")]
Expand Down
100 changes: 95 additions & 5 deletions src/mediaplayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ namespace MediaPlayer {
[Mac (10,12,2)] // type exists only to expose fields
[BaseType (typeof (NSObject))]
#if IOS || WATCH
// introduced in 4.2
#if XAMCORE_4_0
[NoWatch] // marked as unavailable in xcode 12 beta 1
#else
[Watch (5,0)]
[Obsoleted (PlatformName.WatchOS, 7,0, message: "Removed in Xcode 12")]
interface MPMediaEntity : NSSecureCoding {
#endif // XAMCORE_4_0
#else
interface MPMediaItem : NSSecureCoding {
#endif
Expand All @@ -45,6 +49,11 @@ interface MPMediaItem : NSSecureCoding {
[Export ("objectForKeyedSubscript:")]
NSObject GetObject (NSObject key);

#if XAMCORE_4_0
[NoWatch] // marked as unavailable in xcode 12 beta 1
#else
[Obsoleted (PlatformName.WatchOS, 7,0, message: "Removed in Xcode 12")]
#endif
[Field ("MPMediaEntityPropertyPersistentID")]
NSString PropertyPersistentID { get; }

Expand Down Expand Up @@ -453,9 +462,14 @@ interface MPMediaPlaylist : NSSecureCoding {
[Async]
[Export ("addMediaItems:completionHandler:")]
void AddMediaItems (MPMediaItem[] mediaItems, [NullAllowed] Action<NSError> completionHandler);

[iOS (14,0)]
[NullAllowed, Export ("cloudGlobalID")]
string CloudGlobalId { get; }
}

[NoMac, Watch (5,0)]
[Mac (10,16)]
[Watch (5,0)]
[Static]
interface MPMediaPlaylistProperty {
[Field ("MPMediaPlaylistPropertyPersistentID")]
Expand All @@ -479,6 +493,10 @@ interface MPMediaPlaylistProperty {
[NoTV] // do not work on AppleTV devices (only in simulator)
[Field ("MPMediaPlaylistPropertyAuthorDisplayName")]
NSString AuthorDisplayName { get; }

[iOS (14,0)][TV (14,0)][Watch (7,0)]
[Field ("MPMediaPlaylistPropertyCloudGlobalID")]
NSString CloudGlobalId { get; }
}

[NoMac]
Expand Down Expand Up @@ -721,9 +739,15 @@ interface MPMoviePlayerTimedMetadataEventArgs {
MPTimedMetadata [] TimedMetadata { get; }
}

// no [Model] yet... it can be easily created in user code (all abstract) if needed
[NoMac]
#if XAMCORE_4_0
[NoWatch] // marked as unavailable in xcode 12 beta 1
[NoTV]
#else
[Watch (5,0)]
[Obsoleted (PlatformName.TvOS, 14,0, message: "Removed in Xcode 12")]
[Obsoleted (PlatformName.WatchOS, 5,0, message: "Removed in Xcode 12")]
#endif
[Protocol]
interface MPMediaPlayback {
[Abstract]
Expand Down Expand Up @@ -1236,7 +1260,7 @@ interface MPMusicPlayerController : MPMediaPlayback {
}

#if !MONOMAC && !WATCH
[NoTV]
[TV (14,0)]
[BaseType (typeof (UIView))]
interface MPVolumeView {
[Export ("initWithFrame:")]
Expand All @@ -1260,12 +1284,15 @@ interface MPVolumeView {
[Export ("setVolumeThumbImage:forState:")]
void SetVolumeThumbImage ([NullAllowed] UIImage image, UIControlState state);

[return: NullAllowed]
[Export ("minimumVolumeSliderImageForState:")]
UIImage GetMinimumVolumeSliderImage (UIControlState state);

[return: NullAllowed]
[Export ("maximumVolumeSliderImageForState:")]
UIImage GetMaximumVolumeSliderImage (UIControlState state);

[return: NullAllowed]
[Export ("volumeThumbImageForState:")]
UIImage GetVolumeThumbImage (UIControlState state);

Expand All @@ -1280,6 +1307,7 @@ interface MPVolumeView {
void SetRouteButtonImage ([NullAllowed] UIImage image, UIControlState state);

[Deprecated (PlatformName.iOS, 13, 0, message: "See 'AVRoutePickerView' for possible replacements.")]
[return: NullAllowed]
[Export ("routeButtonImageForState:")]
UIImage GetRouteButtonImage (UIControlState state);

Expand Down Expand Up @@ -1448,6 +1476,7 @@ interface MPContentItem {
[Export ("initWithIdentifier:")]
IntPtr Constructor (string identifier);

[NullAllowed]
[Export ("artwork")]
MPMediaItemArtwork Artwork { get; set; }

Expand All @@ -1457,9 +1486,11 @@ interface MPContentItem {
[Export ("playbackProgress")]
float PlaybackProgress { get; set; } // float, not CGFloat

[NullAllowed]
[Export ("subtitle")]
string Subtitle { get; set; }

[NullAllowed]
[Export ("title")]
string Title { get; set; }

Expand Down Expand Up @@ -2157,7 +2188,8 @@ interface MPMusicPlayerPlayParametersQueueDescriptor {

interface IMPSystemMusicPlayerController {}

[NoTV][NoMac]
[NoTV]
[NoMac] // headers have no availability macros on the protocol itself but the only member is not available on macOS
[iOS (11,0), Watch (5,0)]
[Protocol]
interface MPSystemMusicPlayerController {
Expand All @@ -2172,6 +2204,7 @@ interface MPSystemMusicPlayerController {
[TV (10,0,1)][iOS (10,1)]
[NoWatch][NoMac]
interface NSUserActivity_MediaPlayerAdditions {
[return: NullAllowed]
[Export ("externalMediaContentIdentifier")]
NSString GetExternalMediaContentIdentifier ();

Expand All @@ -2198,4 +2231,61 @@ interface AVMediaSelectionGroup_MPNowPlayingInfoLanguageOptionAdditions {
[Export ("makeNowPlayingInfoLanguageOptionGroup")]
MPNowPlayingInfoLanguageOptionGroup CreateNowPlayingInfoLanguageOptionGroup ();
}

interface IMPNowPlayingSessionDelegate {}

[TV (14,0)]
[NoWatch, NoMac, NoiOS]
[Protocol, Model (AutoGeneratedName = true)]
[BaseType (typeof (NSObject))]
interface MPNowPlayingSessionDelegate {

[Export ("nowPlayingSessionDidChangeActive:")]
void DidChangeActive (MPNowPlayingSession nowPlayingSession);

[Export ("nowPlayingSessionDidChangeCanBecomeActive:")]
void DidChangeCanBecomeActive (MPNowPlayingSession nowPlayingSession);
}

[TV (14,0)]
[NoWatch, NoMac, NoiOS]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface MPNowPlayingSession {

[Export ("initWithPlayers:")]
IntPtr Constructor (AVPlayer[] players);

[Export ("players", ArgumentSemantic.Strong)]
AVPlayer[] Players { get; }

[Wrap ("WeakDelegate")]
[NullAllowed]
IMPNowPlayingSessionDelegate Delegate { get; set; }

[NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
NSObject WeakDelegate { get; set; }

[Export ("nowPlayingInfoCenter", ArgumentSemantic.Strong)]
MPNowPlayingInfoCenter NowPlayingInfoCenter { get; }

[Export ("remoteCommandCenter", ArgumentSemantic.Strong)]
MPRemoteCommandCenter RemoteCommandCenter { get; }

[Export ("canBecomeActive")]
bool CanBecomeActive { get; }

[Export ("active")]
bool Active { [Bind ("isActive")] get; }

[Async]
[Export ("becomeActiveIfPossibleWithCompletion:")]
void BecomeActiveIfPossible ([NullAllowed] Action<bool> completion);

[Export ("addPlayer:")]
void AddPlayer (AVPlayer player);

[Export ("removePlayer:")]
void RemovePlayer (AVPlayer player);
}
}
8 changes: 0 additions & 8 deletions tests/xtro-sharpie/iOS-MediaPlayer.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
!missing-null-allowed! 'Foundation.NSObject MediaPlayer.MPMediaEntity::GetObject(Foundation.NSObject)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject MediaPlayer.MPMediaEntity::ValueForProperty(Foundation.NSString)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSObject MediaPlayer.MPMediaPropertyPredicate::get_Value()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'Foundation.NSString MediaPlayer.NSUserActivity_MediaPlayerAdditions::GetExternalMediaContentIdentifier(Foundation.NSUserActivity)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'MediaPlayer.MPContentItem MediaPlayer.MPPlayableContentDataSource::ContentItem(Foundation.NSIndexPath)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'MediaPlayer.MPMediaItem MediaPlayer.MPMediaItemCollection::get_RepresentativeItem()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'MediaPlayer.MPMediaItem[] MediaPlayer.MPMediaPlaylist::get_SeedItems()' is missing an [NullAllowed] on return type
Expand All @@ -62,10 +61,3 @@
!missing-null-allowed! 'MediaPlayer.MPMediaQuerySection[] MediaPlayer.MPMediaQuery::get_CollectionSections()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'MediaPlayer.MPMediaQuerySection[] MediaPlayer.MPMediaQuery::get_ItemSections()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'System.String MediaPlayer.MPMediaPlaylist::get_Name()' is missing an [NullAllowed] on return type
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Artwork(MediaPlayer.MPMediaItemArtwork)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Subtitle(System.String)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Title(System.String)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'UIKit.UIImage MediaPlayer.MPVolumeView::GetMaximumVolumeSliderImage(UIKit.UIControlState)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'UIKit.UIImage MediaPlayer.MPVolumeView::GetMinimumVolumeSliderImage(UIKit.UIControlState)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'UIKit.UIImage MediaPlayer.MPVolumeView::GetRouteButtonImage(UIKit.UIControlState)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'UIKit.UIImage MediaPlayer.MPVolumeView::GetVolumeThumbImage(UIKit.UIControlState)' is missing an [NullAllowed] on return type
2 changes: 0 additions & 2 deletions tests/xtro-sharpie/iOS-MediaPlayer.todo

This file was deleted.

10 changes: 5 additions & 5 deletions tests/xtro-sharpie/macOS-MediaPlayer.ignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## deprecated in iOS 10, not on macOS
!missing-selector! MPMediaItemArtwork::imageCropRect not bound

## protocol without availability - the only member is marked as not available to macOS
!missing-protocol! MPSystemMusicPlayerController not bound

## field added in xcode 12 b1 - but not marked as available on macOS and already deprecated on iOS
!missing-field! MPMediaPlaybackIsPreparedToPlayDidChangeNotification not bound

## unsorted

!unknown-type! MPMediaItem bound

# Initial result from new rule missing-null-allowed
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Artwork(MediaPlayer.MPMediaItemArtwork)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Subtitle(System.String)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Title(System.String)' is missing an [NullAllowed] on parameter #0
9 changes: 0 additions & 9 deletions tests/xtro-sharpie/macOS-MediaPlayer.todo

This file was deleted.

39 changes: 34 additions & 5 deletions tests/xtro-sharpie/tvOS-MediaPlayer.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,37 @@
!missing-field! MPMediaPlaylistPropertyAuthorDisplayName not bound
!missing-field! MPMediaPlaylistPropertyDescriptionText not bound

# Initial result from new rule missing-null-allowed
!missing-null-allowed! 'Foundation.NSString MediaPlayer.NSUserActivity_MediaPlayerAdditions::GetExternalMediaContentIdentifier(Foundation.NSUserActivity)' is missing an [NullAllowed] on return type
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Artwork(MediaPlayer.MPMediaItemArtwork)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Subtitle(System.String)' is missing an [NullAllowed] on parameter #0
!missing-null-allowed! 'System.Void MediaPlayer.MPContentItem::set_Title(System.String)' is missing an [NullAllowed] on parameter #0
## stuff removed in Xcode 12 -> XAMCORE_4_0
!unknown-protocol! MPMediaPlayback bound

## _added_ in xcode12 but already deprecated in iOS9 (likely error in headers)
!missing-field! MPMediaPlaybackIsPreparedToPlayDidChangeNotification not bound
!missing-field! MPMovieDurationAvailableNotification not bound
!missing-field! MPMovieMediaTypesAvailableNotification not bound
!missing-field! MPMovieNaturalSizeAvailableNotification not bound
!missing-field! MPMoviePlayerDidEnterFullscreenNotification not bound
!missing-field! MPMoviePlayerDidExitFullscreenNotification not bound
!missing-field! MPMoviePlayerFullscreenAnimationCurveUserInfoKey not bound
!missing-field! MPMoviePlayerFullscreenAnimationDurationUserInfoKey not bound
!missing-field! MPMoviePlayerIsAirPlayVideoActiveDidChangeNotification not bound
!missing-field! MPMoviePlayerLoadStateDidChangeNotification not bound
!missing-field! MPMoviePlayerNowPlayingMovieDidChangeNotification not bound
!missing-field! MPMoviePlayerPlaybackDidFinishNotification not bound
!missing-field! MPMoviePlayerPlaybackDidFinishReasonUserInfoKey not bound
!missing-field! MPMoviePlayerPlaybackStateDidChangeNotification not bound
!missing-field! MPMoviePlayerReadyForDisplayDidChangeNotification not bound
!missing-field! MPMoviePlayerScalingModeDidChangeNotification not bound
!missing-field! MPMoviePlayerThumbnailErrorKey not bound
!missing-field! MPMoviePlayerThumbnailImageKey not bound
!missing-field! MPMoviePlayerThumbnailImageRequestDidFinishNotification not bound
!missing-field! MPMoviePlayerThumbnailTimeKey not bound
!missing-field! MPMoviePlayerTimedMetadataKeyDataType not bound
!missing-field! MPMoviePlayerTimedMetadataKeyInfo not bound
!missing-field! MPMoviePlayerTimedMetadataKeyLanguageCode not bound
!missing-field! MPMoviePlayerTimedMetadataKeyMIMEType not bound
!missing-field! MPMoviePlayerTimedMetadataKeyName not bound
!missing-field! MPMoviePlayerTimedMetadataUpdatedNotification not bound
!missing-field! MPMoviePlayerTimedMetadataUserInfoKey not bound
!missing-field! MPMoviePlayerWillEnterFullscreenNotification not bound
!missing-field! MPMoviePlayerWillExitFullscreenNotification not bound
!missing-field! MPMovieSourceTypeAvailableNotification not bound
68 changes: 0 additions & 68 deletions tests/xtro-sharpie/tvOS-MediaPlayer.todo

This file was deleted.

4 changes: 4 additions & 0 deletions tests/xtro-sharpie/watchOS-MediaPlayer.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## stuff removed in Xcode 12 -> XAMCORE_4_0
!unknown-field! MPMediaEntityPropertyPersistentID bound
!unknown-protocol! MPMediaPlayback bound
!unknown-type! MPMediaEntity bound
7 changes: 0 additions & 7 deletions tests/xtro-sharpie/watchOS-MediaPlayer.todo

This file was deleted.