From 5a7f305a6a8aaafcf9a8fa7083774a17774d8b83 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Fri, 11 Aug 2017 14:48:12 -0400 Subject: [PATCH] [passkit] Update to beta 5 Identical to PR2475 who suffered from a fatal git issue :( [1] https://github.com/xamarin/xamarin-macios/pull/2475/ --- src/Contacts/CNPostalAddress.cs | 55 ----- src/PassKit/PKEnums.cs | 23 ++ src/PassKit/PKPaymentRequest.cs | 56 +++++ src/contacts.cs | 31 +++ src/frameworks.sources | 4 +- src/generator.cs | 2 + src/passkit.cs | 220 ++++++++++++++++++ tests/introspection/ApiCtorInitTest.cs | 5 + tests/introspection/ApiTypoTest.cs | 3 +- tests/introspection/iOS/iOSApiProtocolTest.cs | 10 + tests/monotouch-test/monotouch-test.csproj | 3 +- tests/xtro-sharpie/common.ignore | 7 + 12 files changed, 361 insertions(+), 58 deletions(-) delete mode 100644 src/Contacts/CNPostalAddress.cs create mode 100644 src/PassKit/PKPaymentRequest.cs diff --git a/src/Contacts/CNPostalAddress.cs b/src/Contacts/CNPostalAddress.cs deleted file mode 100644 index 847003821982..000000000000 --- a/src/Contacts/CNPostalAddress.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// CNPostalAddress.cs: Implements some nicer methods for CNPostalAddress -// -// Authors: -// Alex Soto -// -// Copyright 2015 Xamarin Inc. All rights reserved. -// - -using System; -using XamCore.Foundation; - -namespace XamCore.Contacts { -#if XAMCORE_2_0 // The Contacts framework uses generics heavily, which is only supported in Unified (for now at least) - // Strong typed Keys to enum - public enum CNPostalAddressKeyOption { - Street, - City, - State, - PostalCode, - Country, - IsoCountryCode - } - - public partial class CNPostalAddress { - - public static string LocalizeProperty (CNPostalAddressKeyOption option) - { - var srvc = LocalizeOptionsToNSString (option); - return LocalizeProperty (srvc); - } - - static NSString LocalizeOptionsToNSString (CNPostalAddressKeyOption option) - { - switch (option) { - case CNPostalAddressKeyOption.Street: - return CNPostalAddressKey.Street; - case CNPostalAddressKeyOption.City: - return CNPostalAddressKey.City; - case CNPostalAddressKeyOption.State: - return CNPostalAddressKey.State; - case CNPostalAddressKeyOption.PostalCode: - return CNPostalAddressKey.PostalCode; - case CNPostalAddressKeyOption.Country: - return CNPostalAddressKey.Country; - case CNPostalAddressKeyOption.IsoCountryCode: - return CNPostalAddressKey.IsoCountryCode; - default: - throw new ArgumentOutOfRangeException ("option"); - } - } - } -#endif // XAMCORE_2_0 -} - diff --git a/src/PassKit/PKEnums.cs b/src/PassKit/PKEnums.cs index 6fb91b81d305..af88f43e0c25 100644 --- a/src/PassKit/PKEnums.cs +++ b/src/PassKit/PKEnums.cs @@ -19,6 +19,7 @@ public enum PKErrorCode { // NSInteger -> PKPass.h [iOS (6,0)] + [ErrorDomain ("PKPassKitErrorDomain")] [Native] public enum PKPassKitErrorCode : nint { Unknown = -1, @@ -54,9 +55,19 @@ public enum PKPassType : nuint { public enum PKPaymentAuthorizationStatus : nint { Success, Failure, + + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'Failure' and 'PKPaymentRequest.CreatePaymentBillingAddressInvalidError'.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'Failure' and 'PKPaymentRequest.CreatePaymentBillingAddressInvalidError'.")] InvalidBillingPostalAddress, + + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'Failure' and 'PKPaymentRequest.CreatePaymentShippingAddressInvalidError'.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'Failure' and 'PKPaymentRequest.CreatePaymentShippingAddressInvalidError'.")] InvalidShippingPostalAddress, + + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'Failure' and 'PKPaymentRequest.CreatePaymentContactInvalidError'.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'Failure' and 'PKPaymentRequest.CreatePaymentContactInvalidError'.")] InvalidShippingContact, + [iOS (9,2)] PinRequired, [iOS (9,2)] @@ -80,6 +91,8 @@ public enum PKMerchantCapability : nuint { } [Watch (3,0)] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'PKContactField' instead.")] + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'PKContactField' instead.")] [Native] [Flags] public enum PKAddressField : nuint { @@ -175,4 +188,14 @@ public enum PKAddPassButtonStyle : nint { Black = 0, Outline } + + [Watch (4,0)][iOS (11,0)] + [ErrorDomain ("PKPaymentErrorDomain")] + [Native] + public enum PKPaymentErrorCode : nint { + Unknown = -1, + ShippingContactInvalid = 1, + BillingContactInvalid, + ShippingAddressUnserviceable, + } } diff --git a/src/PassKit/PKPaymentRequest.cs b/src/PassKit/PKPaymentRequest.cs new file mode 100644 index 000000000000..311d6aa3747a --- /dev/null +++ b/src/PassKit/PKPaymentRequest.cs @@ -0,0 +1,56 @@ +using System; +using XamCore.Foundation; +using XamCore.ObjCRuntime; + +namespace XamCore.PassKit { + + public partial class PKContactFieldsExtensions { + + static public PKContactFields GetValue (NSSet set) + { + var fields = PKContactFields.None; + if (set == null) + return fields; + + foreach (PKContactFields value in Enum.GetValues (typeof (PKContactFields))) { + var constant = value.GetConstant (); + // None does not have an associated native value and Contains would throw an ANE + if ((constant != null) && set.Contains (constant)) + fields |= value; + } + return fields; + } + + static public NSSet GetSet (PKContactFields values) + { + var set = new NSMutableSet (); + if (values == PKContactFields.None) + return set; + + foreach (PKContactFields value in Enum.GetValues (typeof (PKContactFields))) { + if (values.HasFlag (value)) { + var constant = value.GetConstant (); + // None does not have an associated native value and Contains would throw an ANE + if (constant != null) + set.Add (constant); + } + } + return set; + } + } + + public partial class PKPaymentRequest { + + [Watch (4,0)][iOS (11,0)] + public PKContactFields RequiredBillingContactFields { + get { return PKContactFieldsExtensions.GetValue (WeakRequiredBillingContactFields); } + set { WeakRequiredBillingContactFields = PKContactFieldsExtensions.GetSet (value); } + } + + [Watch (4,0)][iOS (11,0)] + public PKContactFields RequiredShippingContactFields { + get { return PKContactFieldsExtensions.GetValue (WeakRequiredShippingContactFields); } + set { WeakRequiredShippingContactFields = PKContactFieldsExtensions.GetSet (value); } + } + } +} diff --git a/src/contacts.cs b/src/contacts.cs index a4508804d32c..38645f3fe1e4 100644 --- a/src/contacts.cs +++ b/src/contacts.cs @@ -1076,6 +1076,7 @@ interface CNPostalAddress : NSCopying, NSMutableCopying, NSSecureCoding, INSCopy string LocalizeProperty (NSString property); } +#if !XAMCORE_4_0 [iOS (9,0), Mac (10,11, onlyOn64: true)] [Static] [EditorBrowsable (EditorBrowsableState.Advanced)] @@ -1107,6 +1108,31 @@ interface CNPostalAddressKey { // Can be used in KVO [Field ("CNPostalAddressISOCountryCodeKey")] NSString IsoCountryCode { get; } } +#endif + + [iOS (9,0), Mac (10,11, onlyOn64: true)] + public enum CNPostalAddressKeyOption { + [Field ("CNPostalAddressStreetKey")] + Street, + [Field ("CNPostalAddressCityKey")] + City, + [Field ("CNPostalAddressStateKey")] + State, + [Field ("CNPostalAddressPostalCodeKey")] + PostalCode, + [Field ("CNPostalAddressCountryKey")] + Country, + [Field ("CNPostalAddressISOCountryCodeKey")] + IsoCountryCode, + + [iOS (10,3)] [Mac (10,12,4, onlyOn64: true)] + [Field ("CNPostalAddressSubLocalityKey")] + SubLocality, + + [iOS (10,3)] [Mac (10,12,4, onlyOn64: true)] + [Field ("CNPostalAddressSubAdministrativeAreaKey")] + SubAdministrativeArea, + } [iOS (9,0), Mac (10,11, onlyOn64: true)] [BaseType (typeof (NSFormatter))] @@ -1195,9 +1221,14 @@ interface CNSocialProfile : NSCopying, NSSecureCoding, INSCopying, INSSecureCodi IntPtr Constructor ([NullAllowed] string url, [NullAllowed] string username, [NullAllowed] string userIdentifier, [NullAllowed] string service); [Static] + [EditorBrowsable (EditorBrowsableState.Advanced)] [Export ("localizedStringForKey:")] string LocalizeProperty (NSString key); + [Static] + [Wrap ("LocalizeProperty (key.GetConstant ())")] + string LocalizeProperty (CNPostalAddressKeyOption key); + [Static] [Export ("localizedStringForService:")] string LocalizeService (NSString service); diff --git a/src/frameworks.sources b/src/frameworks.sources index d4f440e5a599..263c2c723613 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -312,7 +312,6 @@ CONTACTS_SOURCES = \ Contacts/CNContactStore.cs \ Contacts/CNInstantMessageAddress.cs \ Contacts/CNObsolete.cs \ - Contacts/CNPostalAddress.cs \ Contacts/CNSocialProfile.cs \ # CoreAnimation (this is really Quartz.framework) @@ -1079,6 +1078,9 @@ OPENGLES_SOURCES = \ PASSKIT_API_SOURCES = \ PassKit/PKEnums.cs \ + +PASSKIT_SOURCES = \ + PassKit/PKPaymentRequest.cs \ # PdfKit diff --git a/src/generator.cs b/src/generator.cs index a8a6476ba14c..6b3f8de0b166 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -677,6 +677,8 @@ public NamespaceManager (string prefix, string customObjCRuntimeNS, bool skipSys if (Frameworks.HaveAudioUnit) ImplicitNamespaces.Add (Get ("AudioUnit")); + if (Frameworks.HaveContacts && Generator.UnifiedAPI) + ImplicitNamespaces.Add (Get ("Contacts")); if (Frameworks.HaveCoreAnimation) ImplicitNamespaces.Add (Get ("CoreAnimation")); if (Frameworks.HaveCoreLocation) diff --git a/src/passkit.cs b/src/passkit.cs index 9f37608442e4..57b4dba64594 100644 --- a/src/passkit.cs +++ b/src/passkit.cs @@ -8,6 +8,7 @@ // using System; +using System.ComponentModel; using XamCore.Contacts; using XamCore.ObjCRuntime; using XamCore.Foundation; @@ -211,9 +212,13 @@ interface PKPayment { [Protocol, Model] [BaseType (typeof (NSObject))] interface PKPaymentAuthorizationViewControllerDelegate { + + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'DidAuthorizePayment2' instead.")] [Export ("paymentAuthorizationViewController:didAuthorizePayment:completion:")] [EventArgs ("PKPaymentAuthorization")] +#if !XAMCORE_4_0 [Abstract] +#endif void DidAuthorizePayment (PKPaymentAuthorizationViewController controller, PKPayment payment, #if XAMCORE_2_0 Action completion); @@ -221,14 +226,25 @@ void DidAuthorizePayment (PKPaymentAuthorizationViewController controller, PKPay PKPaymentAuthorizationHandler completion); #endif + [iOS (11,0)] + [Export ("paymentAuthorizationViewController:didAuthorizePayment:handler:")] + [EventArgs ("PKPaymentAuthorizationResult")] + void DidAuthorizePayment2 (PKPaymentAuthorizationViewController controller, PKPayment payment, Action completion); + [Export ("paymentAuthorizationViewControllerDidFinish:")] [Abstract] void PaymentAuthorizationViewControllerDidFinish (PKPaymentAuthorizationViewController controller); + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'DidSelectShippingMethod2' instead.")] [Export ("paymentAuthorizationViewController:didSelectShippingMethod:completion:")] [EventArgs ("PKPaymentShippingMethodSelected")] void DidSelectShippingMethod (PKPaymentAuthorizationViewController controller, PKShippingMethod shippingMethod, PKPaymentShippingMethodSelected completion); + [iOS (11,0)] + [Export ("paymentAuthorizationViewController:didSelectShippingMethod:handler:")] + [EventArgs ("PKPaymentRequestShippingMethodUpdate")] + void DidSelectShippingMethod2 (PKPaymentAuthorizationViewController controller, PKShippingMethod shippingMethod, Action completion); + [Export ("paymentAuthorizationViewController:didSelectShippingAddress:completion:")] [EventArgs ("PKPaymentShippingAddressSelected")] void DidSelectShippingAddress (PKPaymentAuthorizationViewController controller, ABRecord address, PKPaymentShippingAddressSelected completion); @@ -241,14 +257,26 @@ void DidAuthorizePayment (PKPaymentAuthorizationViewController controller, PKPay void WillAuthorizePayment (PKPaymentAuthorizationViewController controller); [iOS (9,0)] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'DidSelectShippingContact' instead.")] [Export ("paymentAuthorizationViewController:didSelectShippingContact:completion:")] [EventArgs ("PKPaymentSelectedContact")] void DidSelectShippingContact (PKPaymentAuthorizationViewController controller, PKContact contact, PKPaymentShippingAddressSelected completion); + [iOS (11,0)] + [Export ("paymentAuthorizationViewController:didSelectShippingContact:handler:")] + [EventArgs ("PKPaymentRequestShippingContactUpdate")] + void DidSelectShippingContact2 (PKPaymentAuthorizationViewController controller, PKContact contact, Action completion); + [iOS (9,0)] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'DidSelectPaymentMethod2' instead.")] [Export ("paymentAuthorizationViewController:didSelectPaymentMethod:completion:")] [EventArgs ("PKPaymentMethodSelected")] void DidSelectPaymentMethod (PKPaymentAuthorizationViewController controller, PKPaymentMethod paymentMethod, Action completion); + + [iOS (11,0)] + [Export ("paymentAuthorizationViewController:didSelectPaymentMethod:handler:")] + [EventArgs ("PKPaymentRequestPaymentMethodUpdate")] + void DidSelectPaymentMethod2 (PKPaymentAuthorizationViewController controller, PKPaymentMethod paymentMethod, Action completion); } [iOS (8,0)] @@ -345,6 +373,8 @@ interface PKPaymentRequest { [Export ("currencyCode")] string CurrencyCode { get; set; } + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'RequiredBillingContactFields' instead.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'RequiredBillingContactFields' instead.")] [Export ("requiredBillingAddressFields", ArgumentSemantic.UnsafeUnretained)] PKAddressField RequiredBillingAddressFields { get; set; } @@ -354,6 +384,8 @@ interface PKPaymentRequest { [Availability (Deprecated = Platform.iOS_9_0, Message = "Use 'BillingContact' instead.")] ABRecord BillingAddress { get; set; } + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'RequiredShippingContactFields' instead.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'RequiredShippingContactFields' instead.")] [Export ("requiredShippingAddressFields", ArgumentSemantic.UnsafeUnretained)] PKAddressField RequiredShippingAddressFields { get; set; } @@ -387,6 +419,81 @@ interface PKPaymentRequest { [Static] [Export ("availableNetworks")] NSString[] AvailableNetworks { get; } + + [Watch (4,0)][iOS (11,0)] + [Export ("requiredBillingContactFields", ArgumentSemantic.Strong)] + NSSet WeakRequiredBillingContactFields { get; set; } + + [Watch (4,0)][iOS (11,0)] + [Export ("requiredShippingContactFields", ArgumentSemantic.Strong)] + NSSet WeakRequiredShippingContactFields { get; set; } + + [Watch (4,0)][iOS (11,0)] + [NullAllowed, Export ("supportedCountries", ArgumentSemantic.Copy)] + NSSet SupportedCountries { get; set; } + + [Watch (4,0)][iOS (11,0)] + [Static] + [EditorBrowsable (EditorBrowsableState.Advanced)] + [Export ("paymentContactInvalidErrorWithContactField:localizedDescription:")] + NSError CreatePaymentContactInvalidError (NSString field, [NullAllowed] string localizedDescription); + + [Watch (4,0)][iOS (11,0)] + [Static] + [Wrap ("CreatePaymentContactInvalidError (contactField.GetConstant (), localizedDescription)")] + NSError CreatePaymentContactInvalidError (PKContactFields contactField, [NullAllowed] string localizedDescription); + + [Watch (4,0)][iOS (11,0)] + [Static] + [EditorBrowsable (EditorBrowsableState.Advanced)] + [Export ("paymentShippingAddressInvalidErrorWithKey:localizedDescription:")] + NSError CreatePaymentShippingAddressInvalidError (NSString postalAddressKey, [NullAllowed] string localizedDescription); + +#if XAMCORE_2_0 + [Watch (4,0)][iOS (11,0)] + [Static] + [Wrap ("CreatePaymentShippingAddressInvalidError (postalAddress.GetConstant (), localizedDescription)")] + NSError CreatePaymentShippingAddressInvalidError (CNPostalAddressKeyOption postalAddress, [NullAllowed] string localizedDescription); +#endif + + [Watch (4,0)][iOS (11,0)] + [Static] + [EditorBrowsable (EditorBrowsableState.Advanced)] + [Export ("paymentBillingAddressInvalidErrorWithKey:localizedDescription:")] + NSError CreatePaymentBillingAddressInvalidError (NSString postalAddressKey, [NullAllowed] string localizedDescription); + +#if XAMCORE_2_0 + [Watch (4,0)][iOS (11,0)] + [Static] + [Wrap ("CreatePaymentBillingAddressInvalidError (postalAddress.GetConstant (), localizedDescription)")] + NSError CreatePaymentBillingAddressInvalidError (CNPostalAddressKeyOption postalAddress, [NullAllowed] string localizedDescription); +#endif + + [Watch (4,0)][iOS (11,0)] + [Static] + [Export ("paymentShippingAddressUnserviceableErrorWithLocalizedDescription:")] + NSError CreatePaymentShippingAddressUnserviceableError ([NullAllowed] string localizedDescription); + } + + [Watch (4,0)][iOS (11,0)] + [Flags] + enum PKContactFields { + None = 0, + + [Field ("PKContactFieldPostalAddress")] + PostalAddress = 1 << 0, + + [Field ("PKContactFieldEmailAddress")] + EmailAddress = 1 << 1, + + [Field ("PKContactFieldPhoneNumber")] + PhoneNumber = 1 << 2, + + [Field ("PKContactFieldName")] + Name = 1 << 3, + + [Field ("PKContactFieldPhoneticName")] + PhoneticName = 1 << 4, } [Watch (3,0)] @@ -594,8 +701,10 @@ interface PKPass : NSSecureCoding, NSCopying { [Export ("localizedValueForFieldKey:")] NSObject GetLocalizedValue (NSString key); // TODO: Should be enum for PKPassLibraryUserInfoKey +#if !XAMCORE_4_0 [Field ("PKPassKitErrorDomain")] NSString ErrorDomain { get; } +#endif [Since (7,0)] [Export ("userInfo", ArgumentSemantic.Copy)] @@ -670,9 +779,15 @@ interface PKPaymentNetwork { NSString Amex { get; } [iOS (10,3), Watch (3,2)] + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'CarteBancaires' instead.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'CarteBancaires' instead.")] [Field ("PKPaymentNetworkCarteBancaire")] NSString CarteBancaire { get; } + [iOS (11,0)][Watch (4,0)] + [Field ("PKPaymentNetworkCarteBancaires")] + NSString CarteBancaires { get; } + [iOS (9,2)] [Watch (2,2)] [Field ("PKPaymentNetworkChinaUnionPay")] @@ -801,10 +916,16 @@ interface IPKPaymentAuthorizationControllerDelegate {} [BaseType (typeof (NSObject))] interface PKPaymentAuthorizationControllerDelegate { + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'DidAuthorizePayment' overload with the 'Action' parameter instead.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'DidAuthorizePayment' overload with the 'Action' parameter instead.")] [Abstract] [Export ("paymentAuthorizationController:didAuthorizePayment:completion:")] void DidAuthorizePayment (PKPaymentAuthorizationController controller, PKPayment payment, Action completion); + [Watch (4,0)][iOS (11,0)] + [Export ("paymentAuthorizationController:didAuthorizePayment:handler:")] + void DidAuthorizePayment (PKPaymentAuthorizationController controller, PKPayment payment, Action completion); + [Abstract] [Export ("paymentAuthorizationControllerDidFinish:")] void DidFinish (PKPaymentAuthorizationController controller); @@ -812,14 +933,32 @@ interface PKPaymentAuthorizationControllerDelegate { [Export ("paymentAuthorizationControllerWillAuthorizePayment:")] void WillAuthorizePayment (PKPaymentAuthorizationController controller); + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'DidSelectShippingMethod' overload with the 'Action' parameter instead.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'DidSelectShippingMethod' overload with the 'Action' parameter instead.")] [Export ("paymentAuthorizationController:didSelectShippingMethod:completion:")] void DidSelectShippingMethod (PKPaymentAuthorizationController controller, PKShippingMethod shippingMethod, Action completion); + [Watch (4,0)][iOS (11,0)] + [Export ("paymentAuthorizationController:didSelectShippingMethod:handler:")] + void DidSelectShippingMethod (PKPaymentAuthorizationController controller, PKPaymentMethod paymentMethod, Action completion); + + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'DidSelectShippingContact' overload with the 'Action' parameter instead.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'DidSelectShippingContact' overload with the 'Action' parameter instead.")] [Export ("paymentAuthorizationController:didSelectShippingContact:completion:")] void DidSelectShippingContact (PKPaymentAuthorizationController controller, PKContact contact, Action completion); + [Watch (4,0)][iOS (11,0)] + [Export ("paymentAuthorizationController:didSelectShippingContact:handler:")] + void DidSelectShippingContact (PKPaymentAuthorizationController controller, PKContact contact, Action completion); + + [Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'DidSelectPaymentMethod' overload with the 'Action' parameter instead.")] + [Deprecated (PlatformName.iOS, 11,0, message: "Use 'DidSelectPaymentMethod' overload with the 'Action' parameter instead.")] [Export ("paymentAuthorizationController:didSelectPaymentMethod:completion:")] void DidSelectPaymentMethod (PKPaymentAuthorizationController controller, PKPaymentMethod paymentMethod, Action completion); + + [Watch (4,0)][iOS (11,0)] + [Export ("paymentAuthorizationController:didSelectPaymentMethod:handler:")] + void DidSelectPaymentMethod (PKPaymentAuthorizationController controller, PKPaymentMethod paymentMethod, Action completion); } [iOS (10,1)] @@ -866,4 +1005,85 @@ interface PKSuicaPassProperties [Export ("blacklisted")] bool Blacklisted { [Bind ("isBlacklisted")] get; } } + + [Watch (4,0)][iOS (11,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface PKPaymentAuthorizationResult { + [Export ("initWithStatus:errors:")] + [DesignatedInitializer] + IntPtr Constructor (PKPaymentAuthorizationStatus status, [NullAllowed] NSError[] errors); + + [Export ("status", ArgumentSemantic.Assign)] + PKPaymentAuthorizationStatus Status { get; set; } + + [Export ("errors", ArgumentSemantic.Copy)] + NSError[] Errors { get; set; } + } + + [Watch (4,0)][iOS (11,0)] + [BaseType (typeof(NSObject))] + [DisableDefaultCtor] + interface PKPaymentRequestUpdate { + + [Export ("initWithPaymentSummaryItems:")] + [DesignatedInitializer] + IntPtr Constructor (PKPaymentSummaryItem[] paymentSummaryItems); + + [Export ("status", ArgumentSemantic.Assign)] + PKPaymentAuthorizationStatus Status { get; set; } + + [Export ("paymentSummaryItems", ArgumentSemantic.Copy)] + PKPaymentSummaryItem[] PaymentSummaryItems { get; set; } + } + + [Watch (4,0)][iOS (11,0)] + [BaseType (typeof (PKPaymentRequestUpdate))] + [DisableDefaultCtor] + interface PKPaymentRequestShippingContactUpdate { + + [Export ("initWithErrors:paymentSummaryItems:shippingMethods:")] + [DesignatedInitializer] + IntPtr Constructor ([NullAllowed] NSError[] errors, PKPaymentSummaryItem[] paymentSummaryItems, PKShippingMethod[] shippingMethods); + + [Export ("shippingMethods", ArgumentSemantic.Copy)] + PKShippingMethod[] ShippingMethods { get; set; } + + [Export ("errors", ArgumentSemantic.Copy)] + NSError[] Errors { get; set; } + } + + [Watch (4,0)][iOS (11,0)] + [BaseType (typeof (PKPaymentRequestUpdate))] + [DisableDefaultCtor] + interface PKPaymentRequestShippingMethodUpdate { + + // inlined + [Export ("initWithPaymentSummaryItems:")] + [DesignatedInitializer] + IntPtr Constructor (PKPaymentSummaryItem[] paymentSummaryItems); + } + + [Watch (4,0)][iOS (11,0)] + [BaseType (typeof (PKPaymentRequestUpdate))] + [DisableDefaultCtor] + interface PKPaymentRequestPaymentMethodUpdate { + + // inlined + [Export ("initWithPaymentSummaryItems:")] + [DesignatedInitializer] + IntPtr Constructor (PKPaymentSummaryItem[] paymentSummaryItems); + } + + [Static] // not to enum'ify - exposed as NSString inside NSError + interface PKPaymentErrorKeys { + + [Watch (4,0)][iOS (11,0)] + [Field ("PKPaymentErrorContactFieldUserInfoKey")] + NSString ContactFieldUserInfoKey { get; } + + [Watch (4,0)][iOS (11,0)] + [Field ("PKPaymentErrorPostalAddressUserInfoKey")] + NSString PostalAddressUserInfoKey { get; } + } } diff --git a/tests/introspection/ApiCtorInitTest.cs b/tests/introspection/ApiCtorInitTest.cs index 03fa80b7df17..d13d5451c307 100644 --- a/tests/introspection/ApiCtorInitTest.cs +++ b/tests/introspection/ApiCtorInitTest.cs @@ -362,6 +362,11 @@ protected virtual bool Match (ConstructorInfo ctor, Type type) if (ctor.ToString () == "Void .ctor(VNRequestCompletionHandler)") return true; break; + case "PKPaymentRequestShippingContactUpdate": + // a more precise designated initializer is provided + if (ctor.ToString () == "Void .ctor(PKPaymentSummaryItem[])") + return true; + break; } var ep = ctor.GetParameters (); diff --git a/tests/introspection/ApiTypoTest.cs b/tests/introspection/ApiTypoTest.cs index 1243c294de41..25af16e4412d 100644 --- a/tests/introspection/ApiTypoTest.cs +++ b/tests/introspection/ApiTypoTest.cs @@ -99,7 +99,8 @@ public virtual bool Skip (MemberInfo methodName, string typo) { "Autoredirect", "Aliasable", "Backface", - "Bancaire", + "Bancaire", // french + "Bancaires", // french "Bary", "Batc", "Bim", diff --git a/tests/introspection/iOS/iOSApiProtocolTest.cs b/tests/introspection/iOS/iOSApiProtocolTest.cs index c41aedc25078..6b2adbf7f9ce 100644 --- a/tests/introspection/iOS/iOSApiProtocolTest.cs +++ b/tests/introspection/iOS/iOSApiProtocolTest.cs @@ -157,6 +157,11 @@ protected override bool Skip (Type type, string protocolName) case "PKPaymentRequest": case "PKPaymentToken": case "PKLabeledValue": + case "PKPaymentAuthorizationResult": + case "PKPaymentRequestShippingMethodUpdate": + case "PKPaymentRequestUpdate": + case "PKPaymentRequestPaymentMethodUpdate": + case "PKPaymentRequestShippingContactUpdate": // iOS9 case "UIFont": case "AVAssetTrackSegment": @@ -283,6 +288,11 @@ protected override bool Skip (Type type, string protocolName) case "PKPaymentRequest": case "PKPaymentToken": case "PKLabeledValue": + case "PKPaymentAuthorizationResult": + case "PKPaymentRequestShippingMethodUpdate": + case "PKPaymentRequestUpdate": + case "PKPaymentRequestPaymentMethodUpdate": + case "PKPaymentRequestShippingContactUpdate": // iOS9 case "UIFont": case "AVAssetTrackSegment": diff --git a/tests/monotouch-test/monotouch-test.csproj b/tests/monotouch-test/monotouch-test.csproj index 1e8698c2b8e2..180a408d0781 100644 --- a/tests/monotouch-test/monotouch-test.csproj +++ b/tests/monotouch-test/monotouch-test.csproj @@ -1,4 +1,4 @@ - + Debug @@ -658,6 +658,7 @@ + diff --git a/tests/xtro-sharpie/common.ignore b/tests/xtro-sharpie/common.ignore index be32703c4ad3..be7a437e988e 100644 --- a/tests/xtro-sharpie/common.ignore +++ b/tests/xtro-sharpie/common.ignore @@ -85,6 +85,13 @@ !missing-selector! CKRecord::setObject:forKeyedSubscript: not bound +# PassKit + +## made optional in xcode9 beta 3 since they were replaced with newer API +!incorrect-protocol-member! PKPaymentAuthorizationControllerDelegate::paymentAuthorizationController:didAuthorizePayment:completion: is OPTIONAL and should NOT be abstract +!incorrect-protocol-member! PKPaymentAuthorizationViewControllerDelegate::paymentAuthorizationViewController:didAuthorizePayment:completion: is OPTIONAL and should NOT be abstract + + # Metal ## New @required (abstract) methods in existing types (breaking changes)