Skip to content

Commit

Permalink
[Xcode13] Update all already publish frameworks to Xcode13 GA. (xamar…
Browse files Browse the repository at this point in the history
…in#12797)

* [Xcode13] Update all already publish frameworks to Xcode13 GA.

* Address reviews.

* Fix tests.

Co-authored-by: Alex Soto <alex@alexsoto.me>
  • Loading branch information
mandel-macaque and dalexsoto committed Sep 22, 2021
1 parent 011ef43 commit 7367cf0
Show file tree
Hide file tree
Showing 16 changed files with 236 additions and 83 deletions.
21 changes: 21 additions & 0 deletions src/AVFoundation/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,4 +1358,25 @@ public enum AVCaptionConversionValidatorStatus : long
Stopped = 3,
}

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Flags]
[Native]
public enum AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions : ulong
{
None = 0x0,
VideoZoomChanged = 1uL << 0,
FocusModeChanged = 1uL << 1,
ExposureModeChanged = 1uL << 2,
}

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Native]
public enum AVCapturePrimaryConstituentDeviceSwitchingBehavior : long
{
Unsupported = 0,
Auto = 1,
Restricted = 2,
Locked = 3,
}

}
47 changes: 47 additions & 0 deletions src/CoreAnimation/CAStructs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Runtime.Versioning;

using CoreFoundation;
using Foundation;
using ObjCRuntime;

#nullable enable

namespace CoreAnimation {

#if !NET
[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
#else
[SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")]
#endif
[StructLayout (LayoutKind.Sequential)]
public struct CAFrameRateRange
{

public float Minimum;
public float Maximum;
public float Preferred;

public CAFrameRateRange (float min, float max, float preferred) {
Minimum = min;
Maximum = max;
Preferred = preferred;
}

#if !COREBUILD
[Field ("CAFrameRateRangeDefault", "CoreAnimation")]
public static CAFrameRateRange Default
=> (CAFrameRateRange) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreAnimation.Handle, "CAFrameRateRangeDefault"), typeof (CAFrameRateRange))!;
#endif

[DllImport (Constants.CoreAnimationLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
static extern bool CAFrameRateRangeIsEqualToRange (CAFrameRateRange range, CAFrameRateRange other);

public bool IsEqualTo (CAFrameRateRange other)
=> CAFrameRateRangeIsEqualToRange (this, other);

}
}
63 changes: 58 additions & 5 deletions src/avfoundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8211,7 +8211,7 @@ interface AVAssetExportSession {
[Field ("AVAssetExportPresetPassthrough")]
NSString PresetPassthrough { get; }

[NoWatch, NoTV, NoiOS, Mac (10,15)]
[NoWatch, NoTV, iOS (15,0), Mac (10,15)]
[Field ("AVAssetExportPresetAppleProRes4444LPCM")]
NSString PresetAppleProRes4444Lpcm { get; }

Expand Down Expand Up @@ -9248,36 +9248,41 @@ interface AVCaptureAudioPreviewOutput {
float Volume { get; set; } /* float, not CGFloat */
}

#if MONOMAC
[iOS (15,0), MacCatalyst (15,0), NoTV, NoWatch]
[Static]
interface AVAssetExportPresetApple {

[NoiOS, NoMacCatalyst]
[Field ("AVAssetExportPresetAppleM4VCellular")]
NSString M4VCellular { get; }

[NoiOS, NoMacCatalyst]
[Field ("AVAssetExportPresetAppleM4ViPod")]
NSString M4ViPod { get; }

[NoiOS, NoMacCatalyst]
[Field ("AVAssetExportPresetAppleM4V480pSD")]
NSString M4V480pSD { get; }

[NoiOS, NoMacCatalyst]
[Field ("AVAssetExportPresetAppleM4VAppleTV")]
NSString M4VAppleTV { get; }

[NoiOS, NoMacCatalyst]
[Field ("AVAssetExportPresetAppleM4VWiFi")]
NSString M4VWiFi { get; }

[NoiOS, NoMacCatalyst]
[Field ("AVAssetExportPresetAppleM4V720pHD")]
NSString M4V720pHD { get; }

[NoiOS, NoMacCatalyst]
[Field ("AVAssetExportPresetAppleM4V1080pHD")]
NSString M4V1080pHD { get; }

[Field ("AVAssetExportPresetAppleProRes422LPCM")]
NSString ProRes422Lpcm { get; }
}

#endif

[Introduced (PlatformName.MacCatalyst, 14, 0)]
[NoWatch]
Expand Down Expand Up @@ -10364,6 +10369,22 @@ interface AVCaptureMovieFileOutput {
[NoWatch, NoTV, NoMac, iOS (12,0)]
[Export ("supportedOutputSettingsKeysForConnection:")]
string[] GetSupportedOutputSettingsKeys (AVCaptureConnection connection);

[NoWatch, NoTV, MacCatalyst (15, 0), Mac (12, 0), iOS (15, 0)]
[Export ("primaryConstituentDeviceSwitchingBehaviorForRecordingEnabled")]
bool PrimaryConstituentDeviceSwitchingBehaviorForRecordingEnabled { [Bind ("isPrimaryConstituentDeviceSwitchingBehaviorForRecordingEnabled")] get; set; }

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Export ("setPrimaryConstituentDeviceSwitchingBehaviorForRecording:restrictedSwitchingBehaviorConditions:")]
void SetPrimaryConstituentDeviceSwitchingBehavior (AVCapturePrimaryConstituentDeviceSwitchingBehavior switchingBehavior, AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions restrictedSwitchingBehaviorConditions);

[NoWatch, NoTV, MacCatalyst (15, 0), Mac (12, 0), iOS (15, 0)]
[Export ("primaryConstituentDeviceSwitchingBehaviorForRecording")]
AVCapturePrimaryConstituentDeviceSwitchingBehavior PrimaryConstituentDeviceSwitchingBehaviorForRecording { get; }

[NoWatch, NoTV, MacCatalyst (15, 0), Mac (12, 0), iOS (15, 0)]
[Export ("primaryConstituentDeviceRestrictedSwitchingBehaviorConditionsForRecording")]
AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions PrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionsForRecording { get; }
}

[NoTV]
Expand Down Expand Up @@ -11062,7 +11083,39 @@ interface AVCaptureDevice {
[Export ("constituentDevices")]
AVCaptureDevice[] ConstituentDevices { get; }

// from AVCaptureDevice_AVCaptureDeviceCalibration
[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Export ("activePrimaryConstituentDeviceSwitchingBehavior")]
AVCapturePrimaryConstituentDeviceSwitchingBehavior ActivePrimaryConstituentDeviceSwitchingBehavior { get; }

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Export ("activePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions")]
AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions ActivePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions { get; }

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[NullAllowed]
[Export ("activePrimaryConstituentDevice")]
AVCaptureDevice ActivePrimaryConstituentDevice { get; }

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Export ("fallbackPrimaryConstituentDevices", ArgumentSemantic.Assign)]
AVCaptureDevice[] FallbackPrimaryConstituentDevices { get; set; }

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Export ("setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions:")]
void SetPrimaryConstituentDeviceSwitchingBehavior (AVCapturePrimaryConstituentDeviceSwitchingBehavior switchingBehavior, AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions restrictedSwitchingBehaviorConditions);

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Export ("primaryConstituentDeviceRestrictedSwitchingBehaviorConditions")]
AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions PrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions { get; }

[NoWatch, NoTV, MacCatalyst (15,0), Mac (12,0), iOS (15,0)]
[Export ("supportedFallbackPrimaryConstituentDevices")]
AVCaptureDevice[] SupportedFallbackPrimaryConstituentDevices { get; }

[NoWatch, NoTV, MacCatalyst (15, 0), Mac (12, 0), iOS (15, 0)]
[Export ("primaryConstituentDeviceSwitchingBehavior")]
AVCapturePrimaryConstituentDeviceSwitchingBehavior PrimaryConstituentDeviceSwitchingBehavior { get; }

[NoWatch, NoTV, NoMac, iOS (13,0)]
[Static]
[Export ("extrinsicMatrixFromDevice:toDevice:")]
Expand Down
11 changes: 11 additions & 0 deletions src/coreanimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,15 @@ interface CADisplayLink {
double TargetTimestamp { get; }

[Watch (3,0)][TV (10,0)][iOS (10,0)]
[Deprecated (PlatformName.iOS, 10, 0, message: "Use 'PreferredFrameRateRange' instead.")]
[Deprecated (PlatformName.WatchOS, 3, 0, message: "Use 'PreferredFrameRateRange' instead.")]
[Deprecated (PlatformName.TvOS, 10, 0, message: "Use 'PreferredFrameRateRange' instead.")]
[Export ("preferredFramesPerSecond")]
nint PreferredFramesPerSecond { get; set; }

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0)]
[Export ("preferredFrameRateRange", ArgumentSemantic.Assign)]
CAFrameRateRange PreferredFrameRateRange { get; set; }
}
#endif

Expand Down Expand Up @@ -1122,6 +1129,10 @@ interface CAAnimation : CAAction, CAMediaTiming, NSSecureCoding, NSMutableCopyin
SCNAnimationEvent [] AnimationEvents { get; set; }

#endregion

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0)]
[Export ("preferredFrameRateRange", ArgumentSemantic.Assign)]
CAFrameRateRange PreferredFrameRateRange { get; set; }
}

interface ICAAnimationDelegate {}
Expand Down
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ COREANIMATION_API_SOURCES = \

COREANIMATION_CORE_SOURCES = \
CoreAnimation/CATransform3D.cs \
CoreAnimation/CAStructs.cs \

COREANIMATION_SOURCES = \
CoreAnimation/CABasicAnimation.cs \
Expand Down
39 changes: 39 additions & 0 deletions src/gamecontroller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2090,4 +2090,43 @@ interface GCVirtualControllerElementConfiguration
[Export ("actsAsTouchpad")]
bool ActsAsTouchpad { get; set; }
}

[TV (15,0), iOS (15,0), Mac (12,0), NoWatch, MacCatalyst (15,0)]
public enum GCProductCategory
{

[Field ("GCProductCategoryDualSense")]
DualSense,

[Field ("GCProductCategoryDualShock4")]
DualShock4,

[Field ("GCProductCategoryMFi")]
MFi,

[Field ("GCProductCategoryXboxOne")]
XboxOne,

[Field ("GCProductCategorySiriRemote1stGen")]
SiriRemote1stGen,

[Field ("GCProductCategorySiriRemote2ndGen")]
SiriRemote2ndGen,

[Field ("GCProductCategoryControlCenterRemote")]
ControlCenterRemote,

[Field ("GCProductCategoryUniversalElectronicsRemote")]
UniversalElectronicsRemote,

[Field ("GCProductCategoryCoalescedRemote")]
CoalescedRemote,

[Field ("GCProductCategoryMouse")]
Mouse,

[Field ("GCProductCategoryKeyboard")]
Keyboard,
}

}
3 changes: 2 additions & 1 deletion src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10398,7 +10398,7 @@ partial interface UIReferenceLibraryViewController : NSCoding {
}

[BaseType (typeof (NSObject))]
interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus, UIUserActivityRestoring
interface UIResponder : UIAccessibilityAction, UIAccessibilityFocus, UIUserActivityRestoring, UIActivityItemsConfigurationProviding
#if !TVOS
, UIAccessibilityDragging
#endif // !TVOS
Expand Down Expand Up @@ -22784,6 +22784,7 @@ interface IUIActivityItemsConfigurationProviding {}
[Protocol]
interface UIActivityItemsConfigurationProviding {

[NullAllowed]
[Abstract]
[Export ("activityItemsConfiguration", ArgumentSemantic.Strong)]
IUIActivityItemsConfigurationReading ActivityItemsConfiguration { get; }
Expand Down
34 changes: 34 additions & 0 deletions tests/monotouch-test/CoreAnimation/CAFrameRateRangeTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#if !__WATCHOS__
using Foundation;
using CoreAnimation;
using NUnit.Framework;

namespace MonoTouchFixtures.CoreAnimation {

[TestFixture]
[Preserve (AllMembers = true)]
public class CAFrameRateRangeTest {

[SetUp]
public void SetUp ()
=> TestRuntime.AssertXcodeVersion (13,0);

[Test]
public void IsEqualToTest ()
{
var first = new CAFrameRateRange (1.0f, 1.0f, 1.0f);
var second = new CAFrameRateRange (1.5f, 1.0f, 1.0f);

Assert.IsFalse (first.IsEqualTo (second), "Not equal");
Assert.IsTrue (first.IsEqualTo (first), "Equal");
}

[Test]
public void DefaultTest ()
{
var defaultValue = CAFrameRateRange.Default;
Assert.IsTrue (defaultValue.IsEqualTo (defaultValue), "Default");
}
}
}
#endif
3 changes: 3 additions & 0 deletions tests/xtro-sharpie/common-CoreAnimation.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
!missing-pinvoke! CATransform3DMakeScale is not bound
!missing-pinvoke! CATransform3DMakeTranslation is not bound
!missing-selector! CALayer::shouldArchiveValueForKey: not bound

# make no sense in c#
!missing-pinvoke! CAFrameRateRangeMake is not bound
18 changes: 0 additions & 18 deletions tests/xtro-sharpie/iOS-AVFoundation.todo

This file was deleted.

9 changes: 0 additions & 9 deletions tests/xtro-sharpie/iOS-CoreAnimation.todo

This file was deleted.

11 changes: 0 additions & 11 deletions tests/xtro-sharpie/iOS-GameController.todo

This file was deleted.

20 changes: 20 additions & 0 deletions tests/xtro-sharpie/iOS-UIKit.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -505,3 +505,23 @@

## Grouped nint constants
!unknown-native-enum! UIFocusGroupPriority bound

# ignored untilwe fix issue https://github.com/xamarin/xamarin-macios/pull/10087
!missing-selector! NSDiffableDataSourceSectionTransaction::difference not bound
!missing-selector! NSDiffableDataSourceTransaction::difference not bound
!missing-selector! UICollectionViewDiffableDataSourceReorderingHandlers::canReorderItemHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceReorderingHandlers::didReorderHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceReorderingHandlers::setCanReorderItemHandler: not bound
!missing-selector! UICollectionViewDiffableDataSourceReorderingHandlers::setDidReorderHandler: not bound
!missing-selector! UICollectionViewDiffableDataSourceReorderingHandlers::setWillReorderHandler: not bound
!missing-selector! UICollectionViewDiffableDataSourceReorderingHandlers::willReorderHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::setShouldCollapseItemHandler: not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::setShouldExpandItemHandler: not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::setSnapshotForExpandingParentItemHandler: not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::setWillCollapseItemHandler: not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::setWillExpandItemHandler: not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::shouldCollapseItemHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::shouldExpandItemHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::snapshotForExpandingParentItemHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::willCollapseItemHandler not bound
!missing-selector! UICollectionViewDiffableDataSourceSectionSnapshotHandlers::willExpandItemHandler not bound
Loading

0 comments on commit 7367cf0

Please sign in to comment.