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

[CoreHaptics] Add support for Xcode13 beta1. #11963

Merged
merged 3 commits into from
Jun 17, 2021
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
5 changes: 4 additions & 1 deletion src/CoreHaptics/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public enum CHHapticErrorCode : long {
InvalidPatternData = -4813,
InvalidPatternDictionary = -4814,
InvalidAudioSession = -4815,
InvalidEngineParameter = -4816,
InvalidParameterType = -4820,
InvalidEventType = -4821,
InvalidEventTime = -4822,
Expand All @@ -121,6 +122,8 @@ public enum CHHapticErrorCode : long {
BadEventEntry = -4830,
BadParameterEntry = -4831,
InvalidTime = -4840,
FileNotFound = -4851,
InsufficientPower = -4897,
UnknownError = -4898,
MemoryError = -4899,
}
Expand All @@ -145,4 +148,4 @@ public enum CHHapticEngineStoppedReason : long {
GameControllerDisconnect = 6,
SystemError = -1,
}
}
}
25 changes: 24 additions & 1 deletion src/corehaptics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ partial interface CHHapticPatternDefinitionKeys {

[Field ("CHHapticPatternKeyParameterCurveControlPoints")]
NSString ParameterCurveControlPointsKey { get; }

[TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("CHHapticPatternKeyEventWaveformUseVolumeEnvelope")]
NSString EventWaveformUseVolumeEnvelopeKey { get; }
}

[Mac (10,15), iOS (13,0), TV (14, 0)]
Expand All @@ -373,6 +377,9 @@ partial interface CHHapticPatternDefinition {
NSObject WeakParameterCurve { get; set; }
[Export ("ParameterCurveControlPointsKey")]
NSObject WeakParameterCurveControlPoints { get; set; }
[Advice ("The default value is true.")]
[TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
bool EventWaveformUseVolumeEnvelope { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... is this only used as an output ?
because if it's an output then, when created, the value will be false
This can be bound as bool? if the default can (or should) be ignore

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to copy the availability [TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
since this is the public API developers will be using (they keys being internal)

}

[Mac (10,15), iOS (13,0), TV (14, 0)]
Expand Down Expand Up @@ -403,4 +410,20 @@ interface CHHapticPattern {
[return: NullAllowed]
CHHapticPatternDefinition Export ([NullAllowed] out NSError outError);
}
}

[Static]
[Internal]
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch]
partial interface CHHapticAudioResourceKeys {
[Field ("CHHapticAudioResourceKeyUseVolumeEnvelope")]
NSString UseVolumeEnvelopeKey { get; }
}

[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch]
[StrongDictionary ("CHHapticAudioResourceKeys")]
partial interface CHHapticAudioResourceDefinition {
[Advice ("The default value is true.")]
bool UseVolumeEnvelope { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, better use bool? to let developers not change the default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is backed by a NSDictionary, AFAIK if they do nothing, the key should not be added. But We can do a bool?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error BI1033: bgen: Limitation: can not automatically create strongly typed dictionary for (System.Nullable`1[System.Boolean]) the value type of the CoreHaptics.CHHapticPatternDefinition.EventWaveformUseVolumeEnvelope property

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... is that not a NSNumber backed bool ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dalexsoto why are we not able to do nullable? Do we need to fix that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave your message after the tone. beep... Yeah docs says nothing about nullable types so probably are not supported.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already supported as per the API diff:

public class CHHapticAudioResourceDefinition : Foundation.DictionaryContainer {
	// constructors
	public CHHapticAudioResourceDefinition ();
	public CHHapticAudioResourceDefinition (Foundation.NSDictionary dictionary);
	// properties
	public bool? UseVolumeEnvelope { get; set; }
}

}

}
5 changes: 0 additions & 5 deletions tests/xtro-sharpie/MacCatalyst-CoreHaptics.todo

This file was deleted.

5 changes: 0 additions & 5 deletions tests/xtro-sharpie/iOS-CoreHaptics.todo

This file was deleted.

2 changes: 2 additions & 0 deletions tests/xtro-sharpie/macOS-CoreHaptics.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@
!missing-type! CHHapticParameterCurve not bound
!missing-type! CHHapticParameterCurveControlPoint not bound
!missing-type! CHHapticPattern not bound
!missing-field! CHHapticAudioResourceKeyUseVolumeEnvelope not bound
!missing-field! CHHapticPatternKeyEventWaveformUseVolumeEnvelope not bound
2 changes: 0 additions & 2 deletions tests/xtro-sharpie/macOS-CoreHaptics.todo

This file was deleted.

5 changes: 0 additions & 5 deletions tests/xtro-sharpie/tvOS-CoreHaptics.todo

This file was deleted.