-
Notifications
You must be signed in to change notification settings - Fork 331
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
[SK2] send unsynced attributes when syncing purchases #4245
Conversation
@@ -1142,6 +1142,9 @@ private extension PurchasesOrchestrator { | |||
self.backend.post(receipt: .empty, | |||
productData: nil, | |||
transactionData: .init(appUserID: currentAppUserID, | |||
presentedOfferingContext: nil, | |||
unsyncedAttributes: unsyncedAttributes, | |||
storefront: await Storefront.currentStorefront, |
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.
we dont really need the storefront here I think since there are no purchases
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.
nitpick: maybe it's worth splitting this into its own line, like we do in the else code path, that explicitly does createProductRequestData
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.
@aboedo Done! We're now creating transactionData
on it's own line 😎
@@ -1142,6 +1142,9 @@ private extension PurchasesOrchestrator { | |||
self.backend.post(receipt: .empty, | |||
productData: nil, | |||
transactionData: .init(appUserID: currentAppUserID, | |||
presentedOfferingContext: nil, | |||
unsyncedAttributes: unsyncedAttributes, | |||
storefront: await Storefront.currentStorefront, |
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.
Do you have any concerns about the additional await
here adding extra time to this function? I feel like I recall awaiting
on something SK2-related like this when doing network requests added latency in certain scenarios, but I can't recall exactly what it was off the top of my head right now.
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.
we're already awaiting sk2 twice in this codepath already though, right? first verified transaction + app transaction jws?
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.
looks good, but I wouldn't oppose skipping the storefront if it doesn't add value either
@@ -1142,6 +1142,9 @@ private extension PurchasesOrchestrator { | |||
self.backend.post(receipt: .empty, | |||
productData: nil, | |||
transactionData: .init(appUserID: currentAppUserID, | |||
presentedOfferingContext: nil, | |||
unsyncedAttributes: unsyncedAttributes, | |||
storefront: await Storefront.currentStorefront, |
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.
we're already awaiting sk2 twice in this codepath already though, right? first verified transaction + app transaction jws?
@@ -1142,6 +1142,9 @@ private extension PurchasesOrchestrator { | |||
self.backend.post(receipt: .empty, | |||
productData: nil, | |||
transactionData: .init(appUserID: currentAppUserID, | |||
presentedOfferingContext: nil, | |||
unsyncedAttributes: unsyncedAttributes, | |||
storefront: await Storefront.currentStorefront, |
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.
nitpick: maybe it's worth splitting this into its own line, like we do in the else code path, that explicitly does createProductRequestData
@MarkVillacampa There are two other TransactionData properties that we're not including in Should we be including these as well? I can see a scenario where the user presses the syncPurchases button from a paywall and then |
<!-- Thank you for contributing to Purchases! Before pressing the "Create Pull Request" button, please provide the following: --> ### Checklist - [x] If applicable, unit tests - [ ] If applicable, create follow-up issues for `purchases-android` and hybrids ### Motivation When calling syncPurchases with StoreKit 2, we aren't including any unsynced subscriber attributes. ### Description This PR modifies the StoreKit 2 syncPurchases network request to include unsynced subscriber attributes, the storefront, and a nil `presentedOfferingContext`. --------- Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Checklist
purchases-android
and hybridsMotivation
When calling syncPurchases with StoreKit 2, we aren't including any unsynced subscriber attributes.
Description
This PR modifies the StoreKit 2 syncPurchases network request to include unsynced subscriber attributes, the storefront, and a nil
presentedOfferingContext
.