Conversation
…nd-reliability-of
…nd-reliability-of
…nd-reliability-of
This reverts commit a07e3d9.
…nitiation source is purchases
…nd-reliability-of
…ity-of' into sdk-4188-puchases-android-improve-accuracy-and-reliability-of-2
…ity-of-2' into sdk-4188-puchases-android-improve-accuracy-and-reliability-of-3
…ity-of-2' of github.com:RevenueCat/purchases-android into sdk-4188-puchases-android-improve-accuracy-and-reliability-of-3
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2993 +/- ##
==========================================
+ Coverage 78.99% 79.02% +0.03%
==========================================
Files 341 341
Lines 13500 13566 +66
Branches 1825 1839 +14
==========================================
+ Hits 10664 10721 +57
- Misses 2078 2079 +1
- Partials 758 766 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I ended up doing a total refactor by moving most logic from the |
There was a problem hiding this comment.
Pull request overview
This PR addresses an edge case where cached transaction metadata may not be synced if the associated transaction is no longer returned by the Play Store. It adds functionality to post any remaining cached transaction metadata after syncing regular purchases.
Changes:
- Added
getAllLocalTransactionMetadata()method to retrieve all cached transaction metadata - Implemented
postRemainingCachedTransactionMetadata()to sync cached metadata not associated with active transactions - Integrated metadata syncing into the purchase queue sync flow to run after regular transaction processing
- Renamed
TransactionMetadata.userIDfield toappUserIDfor consistency (preserving serialization compatibility)
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| LocalTransactionMetadata.kt | Renamed field from userID to appUserID for naming consistency while preserving JSON serialization compatibility |
| LocalTransactionMetadataStore.kt | Added getAllLocalTransactionMetadata() method to retrieve all cached metadata |
| PostReceiptHelper.kt | Implemented postRemainingCachedTransactionMetadata() and extracted shared logic into performPostReceipt() |
| PostPendingTransactionsHelper.kt | Integrated cached metadata posting after regular transaction sync in all completion paths |
| PurchasesFactory.kt | Updated dependency injection to pass postReceiptHelper to PostPendingTransactionsHelper |
| LocalTransactionMetadataStoreTest.kt | Added comprehensive tests for getAllLocalTransactionMetadata() and updated field references |
| PostReceiptHelperTest.kt | Added tests for postRemainingCachedTransactionMetadata() covering various scenarios including success, errors, and multiple transactions |
| PostPendingTransactionsHelperTest.kt | Added integration tests for cached metadata posting in different sync scenarios |
| SubscriberAttributesPurchasesTests.kt | Updated mock setup to include new dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JayShortway
left a comment
There was a problem hiding this comment.
Nice one! Just a suggestion.
rickvdl
left a comment
There was a problem hiding this comment.
Looks great! And thanks for all the iterations 🙌
…nd-reliability-of
…ity-of' into sdk-4188-puchases-android-improve-accuracy-and-reliability-of-2
…ity-of-2' into sdk-4188-puchases-android-improve-accuracy-and-reliability-of-3
…ity-of-3' into sdk-4188-puchases-android-improve-accuracy-and-reliability-of-4
…dk-4188-puchases-android-improve-accuracy-and-reliability-of-2
…ity-of-2' into sdk-4188-puchases-android-improve-accuracy-and-reliability-of-3
…dk-4188-puchases-android-improve-accuracy-and-reliability-of-3
…ity-of-3' into sdk-4188-puchases-android-improve-accuracy-and-reliability-of-4
…dk-4188-puchases-android-improve-accuracy-and-reliability-of-4
**This is an automatic release.** ## RevenueCat SDK ### 🐞 Bugfixes * Fixes incorrect lifecycle transitions in `CompatComposeView` (#3006) via JayShortway (@JayShortway) * Fixes `showInAppMessages` NPE when the Activity has no content View (#3004) via JayShortway (@JayShortway) ## RevenueCatUI SDK ### Paywallv2 #### 🐞 Bugfixes * Synchronize `cacheDirectory` lazy property to fix `NullPointerException` on `UnsafeLazyImpl` (#3019) via Cesar de la Vega (@vegaro) ### Customer Center #### 🐞 Bugfixes * Simplify determining paid price in Customer Center (#2600) via Cesar de la Vega (@vegaro) ### 🔄 Other Changes * Improve accuracy of transactions origin Part 6: Cleanup, Do not cache user id (#3012) via Toni Rico (@tonidero) * Properly cleanup new shared preferences files between tests (#3016) via Toni Rico (@tonidero) * [AUTOMATIC] Update golden test files for backend integration tests (#3015) via RevenueCat Git Bot (@RCGitBot) * Improve accuracy of transactions origin Part 5: Cleanup (#3002) via Toni Rico (@tonidero) * Improve accuracy of transactions origin Part 4: Post remaining transaction metadata when syncing purchases (#2993) via Toni Rico (@tonidero) * Improve accuracy of transactions origin Part 3: Merge cached data when posting receipts + Cache amazon data (#2989) via Toni Rico (@tonidero) * Improve accuracy of transactions origin Part 2: Store transaction metadata (#2988) via Toni Rico (@tonidero) * Improve accuracy of transactions origin Part 1: Refactor to allow caching transaction metadata (#2987) via Toni Rico (@tonidero) * [AUTOMATIC] Update golden test files for backend integration tests (#3010) via RevenueCat Git Bot (@RCGitBot) * [AUTOMATIC] Update golden test files for backend integration tests (#3008) via RevenueCat Git Bot (@RCGitBot) * Track exit offers (#2975) via Cesar de la Vega (@vegaro) Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Description
Follow-up on #2989
This handles a possible edge case where a transaction is not returned by the store anymore. In this scenario, we still want to post any remaining cached metadata. This handles that by syncing all remaining metadata after any remaining purchases from the queue.