From c9d052a5a0ab79d909466d51e13f204435024cad Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Dec 2024 18:17:42 +0100 Subject: [PATCH] [AVKit] Add missing APIs and fix all xtro issues. (#21836) --- src/avfoundation.cs | 5 ++ src/avkit.cs | 47 ++++++++++++++++--- .../Documentation.KnownFailures.txt | 9 ++++ tests/introspection/iOSApiSelectorTest.cs | 11 +++++ .../MacCatalyst-AVKit.ignore | 4 -- .../MacCatalyst-AVKit.todo | 8 ---- .../api-annotations-dotnet/iOS-AVKit.ignore | 1 - .../api-annotations-dotnet/macOS-AVKit.todo | 2 - .../tvOS-AVFoundation.todo | 1 - .../api-annotations-dotnet/tvOS-AVKit.todo | 6 --- 10 files changed, 66 insertions(+), 28 deletions(-) delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVKit.ignore delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVKit.todo delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/iOS-AVKit.ignore delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/macOS-AVKit.todo delete mode 100644 tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVKit.todo diff --git a/src/avfoundation.cs b/src/avfoundation.cs index bdb043768791..a9a03bf64196 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -17190,4 +17190,9 @@ interface AVAudioApplication { void RequestMicrophoneInjectionPermission (Action response); } + [TV (17, 0), NoMacCatalyst, NoMac, NoiOS] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface AVContinuityDevice { + } } diff --git a/src/avkit.cs b/src/avkit.cs index c3a80553e48a..4b198119323e 100644 --- a/src/avkit.cs +++ b/src/avkit.cs @@ -348,6 +348,7 @@ interface AVPlayerViewController { [TV (15, 0), NoWatch, NoMac, NoiOS, NoMacCatalyst] [Export ("infoViewActions", ArgumentSemantic.Copy)] + [NullAllowed] UIAction [] InfoViewActions { get; set; } [TV (15, 0), NoWatch, NoMac, NoiOS, NoMacCatalyst] @@ -691,6 +692,10 @@ interface AVPlayerView { [Mac (13, 0), NoWatch, NoiOS, NoMacCatalyst, NoTV] [Export ("setMagnification:centeredAtPoint:")] void SetMagnification (nfloat magnification, CGPoint centeredAtPoint); + + [Mac (14, 0)] + [Export ("videoFrameAnalysisTypes")] + AVVideoFrameAnalysisType VideoFrameAnalysisTypes { get; set; } } interface IAVPlayerViewPictureInPictureDelegate { } @@ -1010,18 +1015,15 @@ interface AVPictureInPictureControllerContentSource { // interface AVPictureInPictureControllerContentSource_VideoCallSupport [NoWatch, NoTV, NoMac] - [NoMacCatalyst] // doc as available, intro fails on macOS 12 beta 6 [Export ("initWithActiveVideoCallSourceView:contentViewController:")] NativeHandle Constructor (UIView sourceView, AVPictureInPictureVideoCallViewController contentViewController); [NullAllowed] [NoWatch, NoTV, NoMac] - [NoMacCatalyst] // doc as available, intro fails on macOS 12 beta 6 [Export ("activeVideoCallSourceView", ArgumentSemantic.Weak)] UIView ActiveVideoCallSourceView { get; } [NoWatch, NoTV, NoMac] - [NoMacCatalyst] // doc as available, intro fails on macOS 12 beta 6 [Export ("activeVideoCallContentViewController")] AVPictureInPictureVideoCallViewController ActiveVideoCallContentViewController { get; } @@ -1143,7 +1145,7 @@ interface AVPlaybackSpeed { string LocalizedNumericName { get; } } - [iOS (17, 2), NoMac, NoMacCatalyst, NoTV, NoWatch] + [iOS (17, 2), NoMac, MacCatalyst (17, 2), NoTV, NoWatch] [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface AVCaptureEvent { @@ -1151,7 +1153,7 @@ interface AVCaptureEvent { AVCaptureEventPhase Phase { get; } } - [iOS (17, 2), NoMac, NoMacCatalyst, NoTV, NoWatch] + [iOS (17, 2), NoMac, MacCatalyst (17, 2), NoTV, NoWatch] [Native] public enum AVCaptureEventPhase : ulong { Began, @@ -1159,7 +1161,7 @@ public enum AVCaptureEventPhase : ulong { Cancelled, } - [iOS (17, 2), NoMac, NoMacCatalyst, NoTV, NoWatch] + [iOS (17, 2), NoMac, MacCatalyst (17, 2), NoTV, NoWatch] [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface AVCaptureEventInteraction : UIInteraction { @@ -1172,4 +1174,37 @@ interface AVCaptureEventInteraction : UIInteraction { [Export ("enabled")] bool Enabled { [Bind ("isEnabled")] get; set; } } + + [TV (17, 0), NoMac, NoiOS, NoMacCatalyst] + [BaseType (typeof (UIViewController))] + interface AVContinuityDevicePickerViewController { + [Static] + [Export ("supported")] + bool Supported { [Bind ("isSupported")] get; } + + [Wrap ("WeakDelegate")] + [NullAllowed] + IAVContinuityDevicePickerViewControllerDelegate Delegate { get; set; } + + [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)] + NSObject WeakDelegate { get; set; } + } + + [TV (17, 0), NoMac, NoiOS, NoMacCatalyst] + [Protocol (BackwardsCompatibleCodeGeneration = false), Model] + [BaseType (typeof (NSObject))] + interface AVContinuityDevicePickerViewControllerDelegate { + [Export ("continuityDevicePickerWillBeginPresenting:")] + void WillBeginPresenting (AVContinuityDevicePickerViewController pickerViewController); + + [Export ("continuityDevicePicker:didConnectDevice:")] + void DidConnectDevice (AVContinuityDevicePickerViewController pickerViewController, AVContinuityDevice device); + + [Export ("continuityDevicePickerDidCancel:")] + void DidCancel (AVContinuityDevicePickerViewController pickerViewController); + + [Export ("continuityDevicePickerDidEndPresenting:")] + void DidEndPresenting (AVContinuityDevicePickerViewController pickerViewController); + } + interface IAVContinuityDevicePickerViewControllerDelegate { } } diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index f21be5062d96..11b9066d1d5f 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -26605,6 +26605,7 @@ M:AVKit.AVCaptureView.#ctor(CoreGraphics.CGRect) M:AVKit.AVCaptureView.Dispose(System.Boolean) M:AVKit.AVContentProposalViewController.#ctor(System.String,Foundation.NSBundle) M:AVKit.AVContentProposalViewController.Dispose(System.Boolean) +M:AVKit.AVContinuityDevicePickerViewController.Dispose(System.Boolean) M:AVKit.AVCustomRoutingControllerDelegate_Extensions.DidSelectItem(AVKit.IAVCustomRoutingControllerDelegate,AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingActionItem) M:AVKit.AVCustomRoutingControllerDelegate_Extensions.EventDidTimeOut(AVKit.IAVCustomRoutingControllerDelegate,AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingEvent) M:AVKit.AVCustomRoutingControllerDelegate.DidSelectItem(AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingActionItem) @@ -26673,6 +26674,10 @@ M:AVKit.AVRoutePickerView.Dispose(System.Boolean) M:AVKit.AVRoutePickerViewDelegate_Extensions.DidEndPresentingRoutes(AVKit.IAVRoutePickerViewDelegate,AVKit.AVRoutePickerView) M:AVKit.AVRoutePickerViewDelegate_Extensions.WillBeginPresentingRoutes(AVKit.IAVRoutePickerViewDelegate,AVKit.AVRoutePickerView) M:AVKit.IAVCaptureViewDelegate.StartRecording(AVKit.AVCaptureView,AVFoundation.AVCaptureFileOutput) +M:AVKit.IAVContinuityDevicePickerViewControllerDelegate.DidCancel(AVKit.AVContinuityDevicePickerViewController) +M:AVKit.IAVContinuityDevicePickerViewControllerDelegate.DidConnectDevice(AVKit.AVContinuityDevicePickerViewController,AVFoundation.AVContinuityDevice) +M:AVKit.IAVContinuityDevicePickerViewControllerDelegate.DidEndPresenting(AVKit.AVContinuityDevicePickerViewController) +M:AVKit.IAVContinuityDevicePickerViewControllerDelegate.WillBeginPresenting(AVKit.AVContinuityDevicePickerViewController) M:AVKit.IAVCustomRoutingControllerDelegate.DidSelectItem(AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingActionItem) M:AVKit.IAVCustomRoutingControllerDelegate.EventDidTimeOut(AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingEvent) M:AVKit.IAVCustomRoutingControllerDelegate.HandleEvent(AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingEvent,AVKit.AVCustomRoutingControllerDelegateCompletionHandler) @@ -52743,6 +52748,8 @@ P:AVFoundation.RenderingModeChangeNotificationEventArgs.NewRenderingMode P:AVFoundation.SpatialPlaybackCapabilitiesChangedEventArgs.SpatialAudioEnabledKey P:AVKit.AVCaptureEventInteraction.Enabled P:AVKit.AVCaptureEventInteraction.View +P:AVKit.AVContinuityDevicePickerViewController.Delegate +P:AVKit.AVContinuityDevicePickerViewController.Supported P:AVKit.AVDisplayManager.DisplayCriteriaMatchingEnabled P:AVKit.AVDisplayManager.DisplayModeSwitchInProgress P:AVKit.AVDisplayManager.ModeSwitchEndNotification @@ -71593,6 +71600,7 @@ T:AVKit.AVAudioSessionRouteSelection T:AVKit.AVCaptureEventPhase T:AVKit.AVCaptureViewControlsStyle T:AVKit.AVCaptureViewDelegate +T:AVKit.AVContinuityDevicePickerViewControllerDelegate T:AVKit.AVCustomRoutingControllerDelegate T:AVKit.AVCustomRoutingControllerDelegateCompletionHandler T:AVKit.AVKitError @@ -71606,6 +71614,7 @@ T:AVKit.AVRoutePickerViewButtonStyle T:AVKit.AVRoutePickerViewDelegate T:AVKit.AVVideoFrameAnalysisType T:AVKit.IAVCaptureViewDelegate +T:AVKit.IAVContinuityDevicePickerViewControllerDelegate T:AVKit.IAVCustomRoutingControllerDelegate T:AVKit.IAVPictureInPictureSampleBufferPlaybackDelegate T:AVKit.IAVPlayerViewControllerAnimationCoordinator diff --git a/tests/introspection/iOSApiSelectorTest.cs b/tests/introspection/iOSApiSelectorTest.cs index 15f7cdaf1cd8..3a8f9d9f3d03 100644 --- a/tests/introspection/iOSApiSelectorTest.cs +++ b/tests/introspection/iOSApiSelectorTest.cs @@ -137,6 +137,17 @@ protected override bool CheckResponse (bool value, Type actualType, MethodBase m var declaredType = method.DeclaringType; switch (declaredType.Name) { +#if __MACCATALYST__ + case "AVPictureInPictureControllerContentSource": + switch (name) { + case "activeVideoCallSourceView": + case "activeVideoCallContentViewController": + case "initWithActiveVideoCallSourceView:contentViewController:": + // Headers and docs say these selectors are available in Mac Catalyst 15+, but introspection can only bind them in Mac Catalyst 16+. + return TestRuntime.CheckXcodeVersion (13, 0); + } + break; +#endif case "AVUrlAsset": switch (name) { // fails because it is in-lined via protocol AVContentKeyRecipient diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVKit.ignore deleted file mode 100644 index 7fea3335ffc4..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVKit.ignore +++ /dev/null @@ -1,4 +0,0 @@ -## `VideoCallSupport` category introspection failures on MacCatalyst 15 -!missing-selector! AVPictureInPictureControllerContentSource::activeVideoCallContentViewController not bound -!missing-selector! AVPictureInPictureControllerContentSource::activeVideoCallSourceView not bound -!missing-selector! AVPictureInPictureControllerContentSource::initWithActiveVideoCallSourceView:contentViewController: not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVKit.todo deleted file mode 100644 index 1ad5b7857754..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVKit.todo +++ /dev/null @@ -1,8 +0,0 @@ -!missing-enum! AVCaptureEventPhase not bound -!missing-selector! AVCaptureEvent::phase not bound -!missing-selector! AVCaptureEventInteraction::initWithEventHandler: not bound -!missing-selector! AVCaptureEventInteraction::initWithPrimaryEventHandler:secondaryEventHandler: not bound -!missing-selector! AVCaptureEventInteraction::isEnabled not bound -!missing-selector! AVCaptureEventInteraction::setEnabled: not bound -!missing-type! AVCaptureEvent not bound -!missing-type! AVCaptureEventInteraction not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVKit.ignore deleted file mode 100644 index 05f74c4813ea..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVKit.ignore +++ /dev/null @@ -1 +0,0 @@ -## not available on iOS - but we don't put availability attributes on error codes diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVKit.todo deleted file mode 100644 index 940f89e893a6..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVKit.todo +++ /dev/null @@ -1,2 +0,0 @@ -!missing-selector! AVPlayerView::setVideoFrameAnalysisTypes: not bound -!missing-selector! AVPlayerView::videoFrameAnalysisTypes not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.todo index cfab5485384d..3fde98f4e3e5 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.todo +++ b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.todo @@ -930,7 +930,6 @@ !missing-type! AVCaptureSynchronizedSampleBufferData not bound !missing-type! AVCaptureSystemPressureState not bound !missing-type! AVCaptureVideoDataOutput not bound -!missing-type! AVContinuityDevice not bound !missing-type! AVFrameRateRange not bound !missing-type! AVMetadataBodyObject not bound !missing-type! AVMetadataCatBodyObject not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVKit.todo deleted file mode 100644 index 468c14674123..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVKit.todo +++ /dev/null @@ -1,6 +0,0 @@ -!missing-null-allowed! 'System.Void AVKit.AVPlayerViewController::set_InfoViewActions(UIKit.UIAction[])' is missing an [NullAllowed] on parameter #0 -!missing-protocol! AVContinuityDevicePickerViewControllerDelegate not bound -!missing-selector! +AVContinuityDevicePickerViewController::isSupported not bound -!missing-selector! AVContinuityDevicePickerViewController::delegate not bound -!missing-selector! AVContinuityDevicePickerViewController::setDelegate: not bound -!missing-type! AVContinuityDevicePickerViewController not bound