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

[PassKit] Update bindings for Xcode 13.0 beta 1, 2 #12299

Merged
merged 5 commits into from
Aug 3, 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
7 changes: 6 additions & 1 deletion src/PassKit/PKEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public enum PKPaymentButtonType : long {
Contribute = 14,
[iOS (14,0)]
Tip = 15,
[Mac (12,0), iOS (15,0), Watch (8,0)]
Continue = 16,
}

[Mac (11,0)]
Expand Down Expand Up @@ -221,7 +223,8 @@ public enum PKPaymentMethodType : ulong
Debit,
Credit,
Prepaid,
Store
Store,
EMoney,
}

[Mac (11,0)]
Expand Down Expand Up @@ -252,6 +255,8 @@ public enum PKPaymentErrorCode : long {
ShippingContactInvalid = 1,
BillingContactInvalid,
ShippingAddressUnserviceable,
CouponCodeInvalid,
CouponCodeExpired,
}

[iOS (12,0)]
Expand Down
199 changes: 197 additions & 2 deletions src/passkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ interface PKPassLibrary {
[Watch (6,2), iOS (13,4)]
[Export ("signData:withSecureElementPass:completion:")]
void SignData (NSData signData, PKSecureElementPass secureElementPass, PKPassLibrarySignDataCompletionHandler completion);

[Async (ResultTypeName = "PKServiceProviderDataCompletionResult")]
[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("serviceProviderDataForSecureElementPass:completion:")]
void GetServiceProviderData (PKSecureElementPass secureElementPass, Action<NSData, NSError> completion);
}

[Static]
Expand Down Expand Up @@ -345,6 +350,11 @@ interface PKPaymentAuthorizationViewControllerDelegate {
[Export ("paymentAuthorizationViewController:didRequestMerchantSessionUpdate:")]
[EventArgs ("PKPaymentRequestMerchantSessionUpdate")]
void DidRequestMerchantSessionUpdate (PKPaymentAuthorizationViewController controller, Action<PKPaymentRequestMerchantSessionUpdate> updateHandler);

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("paymentAuthorizationViewController:didChangeCouponCode:handler:")]
[EventArgs ("PKPaymentRequestCouponCodeUpdate")]
void DidChangeCouponCode (PKPaymentAuthorizationViewController controller, string couponCode, Action<PKPaymentRequestCouponCodeUpdate> completion);
}

[Mac (11,0)]
Expand Down Expand Up @@ -416,6 +426,11 @@ interface PKShippingMethod {
[NullAllowed] // by default this property is null
[Export ("detail")]
string Detail { get; set; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[NullAllowed]
[Export ("dateComponentsRange", ArgumentSemantic.Copy)]
PKDateComponentsRange DateComponentsRange { get; set; }
}

[Watch (3,0)]
Expand Down Expand Up @@ -446,6 +461,19 @@ interface PKPaymentRequest {
[Export ("currencyCode")]
string CurrencyCode { get; set; }

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("supportsCouponCode")]
bool SupportsCouponCode { get; set; }

[NullAllowed]
[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("couponCode")]
string CouponCode { get; set; }

[Watch (8,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("shippingContactEditingMode", ArgumentSemantic.Assign)]
PKShippingContactEditingMode ShippingContactEditingMode { get; set; }

[NoMac]
[Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'RequiredBillingContactFields' instead.")]
[Deprecated (PlatformName.iOS, 11,0, message: "Use 'RequiredBillingContactFields' instead.")]
Expand Down Expand Up @@ -548,6 +576,16 @@ interface PKPaymentRequest {
[Static]
[Export ("paymentShippingAddressUnserviceableErrorWithLocalizedDescription:")]
NSError CreatePaymentShippingAddressUnserviceableError ([NullAllowed] string localizedDescription);

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Static]
[Export ("paymentCouponCodeInvalidErrorWithLocalizedDescription:")]
NSError GetCouponCodeInvalidError ([NullAllowed] string localizedDescription);

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Static]
[Export ("paymentCouponCodeExpiredErrorWithLocalizedDescription:")]
NSError GetCouponCodeExpiredError ([NullAllowed] string localizedDescription);
}

[Mac (11,0)]
Expand Down Expand Up @@ -1140,7 +1178,11 @@ interface PKPaymentAuthorizationControllerDelegate {
[MacCatalyst (14,0)]
[Export ("paymentAuthorizationController:didRequestMerchantSessionUpdate:")]
void DidRequestMerchantSessionUpdate (PKPaymentAuthorizationController controller, Action<PKPaymentRequestMerchantSessionUpdate> handler);


[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("paymentAuthorizationController:didChangeCouponCode:handler:")]
void DidChangeCouponCode (PKPaymentAuthorizationController controller, string couponCode, Action<PKPaymentRequestCouponCodeUpdate> completion);

[Watch (7,0)][iOS (14,0)]
[MacCatalyst (14,0)]
[Export ("presentationWindowForPaymentAuthorizationController:")]
Expand Down Expand Up @@ -1171,7 +1213,7 @@ interface PKLabeledValue

[Mac (11,0)]
[Watch (4,3), iOS (11,3)]
[BaseType (typeof (NSObject))]
[BaseType (typeof (PKStoredValuePassProperties))]
[DisableDefaultCtor]
interface PKTransitPassProperties {

Expand All @@ -1180,9 +1222,17 @@ interface PKTransitPassProperties {
[return: NullAllowed]
PKTransitPassProperties GetPassProperties (PKPass pass);
Copy link
Contributor

Choose a reason for hiding this comment

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

that's a breaking change to remove this API

Copy link
Member Author

Choose a reason for hiding this comment

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

When I see diffs like -+ (nullable instancetype)passPropertiesForPass:(PKPass *)pass; for something that leads to a breaking change, should I just ignore it then?

Copy link
Contributor

Choose a reason for hiding this comment

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

I need more context

+ (nullable instancetype)passPropertiesForPass:(PKPass *)pass;

looks identical to what we already have. I could be because the header moved the definition or duplicated a member in a subclass...

In any case we must find a way to expose new API without breaking changes


[Deprecated (PlatformName.iOS, 15, 0)]
[Deprecated (PlatformName.WatchOS, 8, 0)]
[Deprecated (PlatformName.MacOSX, 12, 0)]
Copy link
Member

Choose a reason for hiding this comment

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

MacCatalyst?

[Deprecated (PlatformName.MacCatalyst, 15, 0)]
[Export ("transitBalance", ArgumentSemantic.Copy)]
NSDecimalNumber TransitBalance { get; }

[Deprecated (PlatformName.iOS, 15, 0)]
[Deprecated (PlatformName.WatchOS, 8, 0)]
[Deprecated (PlatformName.MacOSX, 12, 0)]
Copy link
Member

Choose a reason for hiding this comment

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

Same, MacCatalyst?

[Deprecated (PlatformName.MacCatalyst, 15, 0)]
[Export ("transitBalanceCurrencyCode")]
string TransitBalanceCurrencyCode { get; }

Expand All @@ -1192,6 +1242,7 @@ interface PKTransitPassProperties {
[Deprecated (PlatformName.iOS, 14,5, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.MacCatalyst, 14,5, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.WatchOS, 7,4, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.MacOSX, 11,3, message: "Use 'Blocked' instead.")]
[Export ("blacklisted")]
bool Blacklisted { [Bind ("isBlacklisted")] get; }

Expand Down Expand Up @@ -1244,6 +1295,8 @@ interface PKSuicaPassProperties
[Export ("blacklisted")]
[Deprecated (PlatformName.iOS, 14,5, message: "Use 'Blocked' instead.")] // exists in base class
[Deprecated (PlatformName.WatchOS, 7,4, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.MacOSX, 11,3, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.MacCatalyst, 14,5, message: "Use 'Blocked' instead.")]
bool Blacklisted { [Bind ("isBlacklisted")] get; }
}

Expand Down Expand Up @@ -1278,6 +1331,10 @@ interface PKPaymentRequestUpdate {

[Export ("paymentSummaryItems", ArgumentSemantic.Copy)]
PKPaymentSummaryItem[] PaymentSummaryItems { get; set; }

[Watch (8,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("shippingMethods", ArgumentSemantic.Copy)]
PKShippingMethod[] ShippingMethods { get; set; }
}

[Mac (11,0)]
Expand Down Expand Up @@ -1569,6 +1626,10 @@ interface PKShareablePassMetadata {
[Export ("initWithProvisioningCredentialIdentifier:cardConfigurationIdentifier:sharingInstanceIdentifier:passThumbnailImage:ownerDisplayName:localizedDescription:")]
IntPtr Constructor (string credentialIdentifier, string cardConfigurationIdentifier, string sharingInstanceIdentifier, CGImage passThumbnailImage, string ownerDisplayName, string localizedDescription);

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("initWithProvisioningCredentialIdentifier:sharingInstanceIdentifier:passThumbnailImage:ownerDisplayName:localizedDescription:accountHash:templateIdentifier:relyingPartyIdentifier:requiresUnifiedAccessCapableDevice:")]
IntPtr Constructor (string credentialIdentifier, string sharingInstanceIdentifier, CGImage passThumbnailImage, string ownerDisplayName, string localizedDescription, string accountHash, string templateIdentifier, string relyingPartyIdentifier, bool requiresUnifiedAccessCapableDevice);

[Export ("credentialIdentifier", ArgumentSemantic.Strong)]
string CredentialIdentifier { get; }

Expand All @@ -1586,6 +1647,22 @@ interface PKShareablePassMetadata {

[Export ("ownerDisplayName", ArgumentSemantic.Strong)]
string OwnerDisplayName { get; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("accountHash", ArgumentSemantic.Strong)]
string AccountHash { get; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("templateIdentifier", ArgumentSemantic.Strong)]
string TemplateIdentifier { get; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("relyingPartyIdentifier", ArgumentSemantic.Strong)]
string RelyingPartyIdentifier { get; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("requiresUnifiedAccessCapableDevice")]
bool RequiresUnifiedAccessCapableDevice { get; }
}

[NoWatch, NoTV]
Expand Down Expand Up @@ -1858,6 +1935,23 @@ interface PKPaymentRequestMerchantSessionUpdate {
PKPaymentMerchantSession Session { get; set; }
}

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof(PKPaymentRequestUpdate))]
[DisableDefaultCtor]
interface PKPaymentRequestCouponCodeUpdate
{
[Export ("initWithPaymentSummaryItems:")]
[DesignatedInitializer]
IntPtr Constructor (PKPaymentSummaryItem[] paymentSummaryItems);

[Export ("initWithErrors:paymentSummaryItems:shippingMethods:")]
[DesignatedInitializer]
IntPtr Constructor ([NullAllowed] NSError[] errors, PKPaymentSummaryItem[] paymentSummaryItems, PKShippingMethod[] shippingMethods);

[NullAllowed, Export ("errors", ArgumentSemantic.Copy)]
NSError[] Errors { get; set; }
}

[Watch (7,0)][Mac (11,0)][iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (NSObject))]
Expand All @@ -1873,4 +1967,105 @@ enum PKRadioTechnology : ulong {
Nfc = 1 << 0,
Bluetooth = 1 << 1,
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface PKDateComponentsRange : NSCopying, NSSecureCoding
{
[Export ("initWithStartDateComponents:endDateComponents:")]
[return: NullAllowed]
IntPtr Constructor (NSDateComponents startDateComponents, NSDateComponents endDateComponents);

[Export ("startDateComponents", ArgumentSemantic.Copy)]
NSDateComponents StartDateComponents { get; }

[Export ("endDateComponents", ArgumentSemantic.Copy)]
NSDateComponents EndDateComponents { get; }
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(PKPaymentSummaryItem))]
[DisableDefaultCtor]
interface PKDeferredPaymentSummaryItem
{
[Export ("deferredDate", ArgumentSemantic.Copy)]
NSDate DeferredDate { get; set; }
}

[Watch (8,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Native]
public enum PKShippingContactEditingMode : ulong
{
Enabled = 1,
StorePickup,
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(PKPaymentSummaryItem))]
[DisableDefaultCtor]
interface PKRecurringPaymentSummaryItem
{
[NullAllowed, Export ("startDate", ArgumentSemantic.Copy)]
NSDate StartDate { get; set; }

[Export ("intervalUnit", ArgumentSemantic.Assign)]
NSCalendarUnit IntervalUnit { get; set; }

[Export ("intervalCount")]
nint IntervalCount { get; set; }

[NullAllowed, Export ("endDate", ArgumentSemantic.Copy)]
NSDate EndDate { get; set; }
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
public enum PKStoredValuePassBalanceType
{
[Field ("PKStoredValuePassBalanceTypeCash")]
Cash,
[Field ("PKStoredValuePassBalanceTypeLoyaltyPoints")]
LoyaltyPoints,
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface PKStoredValuePassBalance
{
[Export ("amount", ArgumentSemantic.Strong)]
NSDecimalNumber Amount { get; }

[NullAllowed, Export ("currencyCode")]
string CurrencyCode { get; }

[Export ("balanceType")]
string BalanceType { get; }

[NullAllowed, Export ("expiryDate", ArgumentSemantic.Strong)]
NSDate ExpiryDate { get; }

[Export ("isEqualToBalance:")]
bool IsEqual (PKStoredValuePassBalance balance);
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface PKStoredValuePassProperties
{
[Static]
[Export ("passPropertiesForPass:")]
[return: NullAllowed]
PKStoredValuePassProperties GetPassProperties (PKPass pass);

[Export ("blocked")]
bool Blocked { [Bind ("isBlocked")] get; }

[NullAllowed, Export ("expirationDate", ArgumentSemantic.Copy)]
NSDate ExpirationDate { get; }

[Export ("balances", ArgumentSemantic.Copy)]
PKStoredValuePassBalance[] Balances { get; }
}
}
13 changes: 13 additions & 0 deletions tests/introspection/iOS/iOSApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ protected override bool Skip (Type type, string protocolName)
case "ARSkeletonDefinition": // device only
case "ARVideoFormat": // device only
case "NSMergePolicy":
case "PKDeferredPaymentSummaryItem":
case "PKPaymentRequestCouponCodeUpdate":
case "PKRecurringPaymentSummaryItem":
case "PKStoredValuePassBalance":
case "PKStoredValuePassProperties":
case "SFSafariViewControllerPrewarmingToken": // conformance not in headers
case "SRTextInputSession": // conformance not in headers
return true;
Expand Down Expand Up @@ -682,6 +687,11 @@ protected override bool Skip (Type type, string protocolName)
case "ARSkeletonDefinition": // device only
case "ARVideoFormat": // device only
case "NSMergePolicy":
case "PKDeferredPaymentSummaryItem":
case "PKPaymentRequestCouponCodeUpdate":
case "PKRecurringPaymentSummaryItem":
case "PKStoredValuePassBalance":
case "PKStoredValuePassProperties":
case "SFSafariViewControllerPrewarmingToken": // conformance not in headers
case "SRTextInputSession": // conformance not in headers
return true;
Expand Down Expand Up @@ -765,6 +775,9 @@ protected override bool Skip (Type type, string protocolName)
case "NSMappingModel":
case "NSMergePolicy":
case "NSPropertyMapping":
case "PKDeferredPaymentSummaryItem":
case "PKRecurringPaymentSummaryItem":
case "PKStoredValuePassProperties":
return true;
}
break;
Expand Down
Loading