-
Notifications
You must be signed in to change notification settings - Fork 514
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] Add support Xcode15 Beta 7 #19139
Conversation
src/passkit.cs
Outdated
[Export ("delegate", ArgumentSemantic.Assign)] | ||
IPKPayLaterViewDelegate Delegate { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a lot of 'extra-null' xtro errors when using the WeakDelegate and casting with different combinations of nullallowed. I saw an example similar to this - is this alright?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the typical pattern I think:
[Export ("delegate", ArgumentSemantic.Assign)]
NSObject WeakDelegate { get; set; }
[Wrap ("WeakDelegate")]
IPKPayLaterViewDelegate Delegate { get; set; }
that doesn't work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rolfbjarne These are the results I received last week :/
[Wrap ("WeakDelegate")]
IPKPayLaterViewDelegate Delegate { get; set; }
[Export ("delegate", ArgumentSemantic.Assign)]
NSObject WeakDelegate { get; set;
Gives me:
Build error: build/dotnet/ios/generated-sources/PassKit/PKPayLaterView.g.cs(215,20): error CS8601: Possible null reference assignment.
[NullAllowed, Wrap ("WeakDelegate")]
IPKPayLaterViewDelegate Delegate { get; set; }
[NullAllowed, Export ("delegate", ArgumentSemantic.Assign)]
NSObject WeakDelegate { get; set; }
Gives me:
!extra-null-allowed! 'System.Void PassKit.PKPayLaterView::set_WeakDelegate(Foundation.NSObject)' has a extraneous [NullAllowed] on parameter #0
[Wrap ("WeakDelegate")]
IPKPayLaterViewDelegate Delegate { get; set; }
[NullAllowed, Export ("delegate", ArgumentSemantic.Assign)]
NSObject WeakDelegate { get; set; }
Gives me:
!extra-null-allowed! 'System.Void PassKit.PKPayLaterView::set_WeakDelegate(Foundation.NSObject)' has a extraneous [NullAllowed] on parameter #0
[NullAllowed, Wrap ("WeakDelegate")]
IPKPayLaterViewDelegate Delegate { get; set; }
[Export ("delegate", ArgumentSemantic.Assign)]
NSObject WeakDelegate { get; set; }
Gives me:
Build error: build/dotnet/ios/generated-sources/PassKit/PKPayLaterView.g.cs(215,20): error CS8601: Possible null reference assignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If helpful, I gisted the generated file in question with the current changes and the proposed change that gave it the nullable issue: https://gist.github.com/tj-devel709/25ab695c8b58e15ec1200c45f2a6322f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alex suggested to use the Nullable on both and add the xtro failure to the .ignore file
|
|
||
[iOS (17, 0), Mac (14, 0), Watch (10, 0), NoTV, MacCatalyst (17, 0)] | ||
[Field ("PKPaymentNetworkTmoney")] | ||
NSString Tmoney { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact, 'TMoney' was my fake rapper name in Jr. Highschool
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking until we have some clear opinion about my comments.
src/passkit.cs
Outdated
#if XAMCORE_5_0 | ||
[Export ("currencyCode")] | ||
#else | ||
[NullAllowed, Export ("currencyCode")] | ||
#endif | ||
string CurrencyCode { get; set; } | ||
|
||
#if XAMCORE_5_0 | ||
[Export ("summaryItems", ArgumentSemantic.Copy)] | ||
#else | ||
[NullAllowed, Export ("summaryItems", ArgumentSemantic.Copy)] | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mixed feelings about this two #if.. in one hand I do understand them, we moved from 'string?' to 'string'. Peres is not an API breaking change, and code will compile unless the developer has the nullability warnings sets as errors.
So the removal of the ? will move use from a possible runtime error (we passed null) to a compiler warning possible error. I prefer users to get a warning than a runtime error in their applications when they are deployed to iOS 15 and later, specially when we do not have a clear date for XAMCORE_5_0.
@dalexsoto @rolfbjarne thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other side is that if the API is actually nullable (for instance by accident on Apple's side), removing the nullability on our side will now result in a C# exception (ArgumentNullException) when the code previously worked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CurrencyCode might have not been an accident based on the documentation from the service https://developer.apple.com/documentation/passkit/apple_pay/payment_token_format_reference?language=objc
currencyCode | string | ISO 4217 numeric currency code, as a string to preserve leading zeros
-- | -- | --
And it uses https://www.iso.org/iso-4217-currency-codes.html which AFAIK does not have a way to represent null.
Similar to the summary items https://developer.apple.com/documentation/passkit/pkdisbursementrequest/3112810-summaryitems?changes=l_4&language=objc
This array must contain one [PKPaymentSummaryItem](https://developer.apple.com/documentation/passkit/pkpaymentsummaryitem?changes=l_4&language=objc), which contains the amount the individual receives.
If we allow null values, the requests to the payment service won't be valid at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way works for me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My take is that we should try to expose the truth of the headers as much as we can, in this case:
-@property (nonatomic, copy, nullable) NSArray<PKPaymentSummaryItem *> *summaryItems API_AVAILABLE(ios(12.2)) API_UNAVAILABLE(tvos, watchos, macos);
+@property (nonatomic, copy) NSArray<PKPaymentSummaryItem *> *summaryItems;
Apple in theory has audited this header for nullability (see NS_ASSUME_NONNULL_BEGIN
at the beginning of the file) so I hope they know what they are doing with their API.
Also from the docs standpoint it changed:
-// The summary items are optional. The final amount summary item will be prepopulated by the amount specified above.
+// Array of PKPaymentSummaryItem objects which should be presented to the user.
+// The last item should be the total you wish to disburse, and should not be pending.
So from the wording I think the change is intentional, it kind of matches what it is being done with the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I went ahead and removed those Xamcore conditionals! @rolfbjarne @mandel-macaque
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💻 [CI Build] Windows Integration Tests passed 💻✅ All Windows Integration Tests passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻✅ All tests on macOS M1 - Mac Big Sur (11.5) passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻✅ All tests on macOS M1 - Mac Ventura (13.0) passed. Pipeline on Agent |
📚 [PR Build] Artifacts 📚Packages generatedView packagesPipeline on Agent |
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes).NET (No breaking changes)✅ API diff vs stableLegacy Xamarin (No breaking changes).NET (No breaking changes)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: simulator tests 0 tests crashed, 1 tests failed, 234 tests passed. Failures❌ dotnettests tests
Html Report (VSDrops) Download Successes✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Unrelated Test Failure:
|
/sudo backport release/8.0.1xx |
Backport Job to branch release/8.0.1xx Created! The magic is happening here |
Oh no! Backport failed! Please see https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=8578782 for more details. |
/sudo backport release/8.0.1xx |
Backport Job to branch release/8.0.1xx Created! The magic is happening here |
Hooray! Backport succeeded! Please see https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=8579127 for more details. |
The bindings for PassKit Xcode15 Beta 7. Backport of #19139 --------- Co-authored-by: tj_devel709 <[email protected]>
The bindings for PassKit Xcode15 Beta 7.