Fix google play purchases missing purchase date#2703
Merged
Conversation
vegaro
approved these changes
Jun 26, 2023
tonidero
pushed a commit
that referenced
this pull request
Jun 26, 2023
**This is an automatic release.** ### Bugfixes * Fix google play purchases missing purchase date (#2703) via Toni Rico (@tonidero) ### Other Changes * `PurchaseTester`: fixed `watchOS` build and ASC deployment (#2701) via NachoSoto (@NachoSoto) * Add `Data.sha1` (#2696) via NachoSoto (@NachoSoto) * Refactor: extract `ErrorResponse` into its own file (#2697) via NachoSoto (@NachoSoto) * Add `Sequence<AdditiveArithmetic>.sum()` (#2694) via NachoSoto (@NachoSoto) * Refactored `Data.asString` implementation (#2695) via NachoSoto (@NachoSoto) * `Diagnostics`: new `FileHandler` for abstracting file operations (#2673) via NachoSoto (@NachoSoto)
aboedo
reviewed
Jun 26, 2023
aboedo
left a comment
Member
There was a problem hiding this comment.
Thanks for taking care of this so quickly!
|
|
||
| private extension CustomerInfo { | ||
|
|
||
| static func productID(productID: String, purchase: CustomerInfoResponse.Subscription) -> String { |
Member
There was a problem hiding this comment.
I'm a bit late to the game, but I think a more swift-y name for this would be something like:
static func productID(_ productID: String, from purchase: CustomerInfoResponse.Subscription)and given that this is called from a function called extractPurchaseDates, I'd follow the same scheme here, i.e.:
static func extractProductIDAndBasePlan(from productID: String, purchase: CustomerInfoResponse.Subscription)- making clear that it's also doing something with a base plan, since having a function called productID that takes the productID seems confusing unless you look at the implementation
- using
extractfor consistency - using parameter names to make the name slightly cleaner
NachoSoto
reviewed
Jun 26, 2023
| expect(purchaseDate) == Date(timeIntervalSince1970: 1526797490) | ||
| } | ||
|
|
||
| func testPurchaseDateForGooglePlayProductIdentifier() throws { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reported in RevenueCat/purchases-flutter#738.
After #2654, we were using the new Google Play identifiers that include the plan id in expiration dates, but we didn't change the system that parses purchase dates. Later on, when we map purchases, we iterate over the expiration dates map, and since that id wasn't found in the purchase dates, it was null, causing the issue in flutter.
This makes the purchase date calculation use the same algorithm that we use for expiration dates to get the new google play product identifiers.