Skip to content

Get offerings response from disk cache if available#1029

Merged
tonidero merged 5 commits into
mainfrom
toniricodiez/sdk-3094-persist-offerings-cache-android-3
May 29, 2023
Merged

Get offerings response from disk cache if available#1029
tonidero merged 5 commits into
mainfrom
toniricodiez/sdk-3094-persist-offerings-cache-android-3

Conversation

@tonidero

Copy link
Copy Markdown
Contributor

Description

Third and final part of persisting offerings in disk to make the system more robust. In this final PR, we use the offerings response cached in #1028 so, in case of a backend error getting offerings, we can calculate the offerings (as long as Play store/Amazon store still give us the product information) as long as we have cached the value before.

@tonidero tonidero added the pr:feat A new feature label May 26, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully we can start improving our integration test suite slowly 😊

@tonidero tonidero marked this pull request as ready for review May 26, 2023 14:18
@tonidero tonidero requested a review from a team May 26, 2023 14:18
@codecov

codecov Bot commented May 26, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1029 (ac64e3b) into main (3395b97) will decrease coverage by 0.01%.
The diff coverage is 85.71%.

❗ Current head ac64e3b differs from pull request most recent head 6c6eba1. Consider uploading reports for the commit 6c6eba1 to get more accurate results

@@            Coverage Diff             @@
##             main    #1029      +/-   ##
==========================================
- Coverage   85.51%   85.51%   -0.01%     
==========================================
  Files         175      175              
  Lines        6111     6116       +5     
  Branches      855      856       +1     
==========================================
+ Hits         5226     5230       +4     
- Misses        549      550       +1     
  Partials      336      336              
Impacted Files Coverage Δ
...om/revenuecat/purchases/strings/OfferingStrings.kt 0.00% <ø> (ø)
...cat/purchases/common/offerings/OfferingsManager.kt 83.05% <85.71%> (-0.29%) ⬇️

@NachoSoto NachoSoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question about the type of errors we handle.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In iOS I'm only doing this for "server is down" errors FWIW. I don't think this is bad but might want to keep the behavior the same?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm right... I do think we can just use cached offerings for other types of errors... But we can discuss that further and be minimal for now. Will do the change 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4270a5e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty clean 👍🏻

@NachoSoto NachoSoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question about the type of errors we handle.

@tonidero tonidero force-pushed the toniricodiez/sdk-3094-persist-offerings-cache-android-2 branch from 076228d to e767e1c Compare May 29, 2023 08:57
Base automatically changed from toniricodiez/sdk-3094-persist-offerings-cache-android-2 to main May 29, 2023 09:15
@tonidero tonidero force-pushed the toniricodiez/sdk-3094-persist-offerings-cache-android-3 branch from 1c7d62a to ac64e3b Compare May 29, 2023 09:18
@tonidero

Copy link
Copy Markdown
Contributor Author

@NachoSoto I added that change to only use the cached offerings on server errors. Going to merge this but lmk if you have any further comments on those changes and can address them on new PRs

@tonidero tonidero enabled auto-merge (squash) May 29, 2023 09:59
@tonidero tonidero merged commit 30ac5b1 into main May 29, 2023
@tonidero tonidero deleted the toniricodiez/sdk-3094-persist-offerings-cache-android-3 branch May 29, 2023 10:24
@tonidero tonidero added refactor and removed pr:feat A new feature labels Jun 1, 2023
tonidero added a commit that referenced this pull request Jun 1, 2023
**This is an automatic release.**

### New Features
* Offline entitlements support (#1030) via Toni Rico (@tonidero)
### Bugfixes
* Fix billing connection error when querying purchases early in the
process lifetime (#1032) via Toni Rico (@tonidero)
### Performance Improvements
* Perform product entitlement mapping request after more critical
requests (#1017) via Toni Rico (@tonidero)
### Dependency Updates
* Bump fastlane from 2.212.2 to 2.213.0 (#1024) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Get offerings response from disk cache if available (#1029) via Toni
Rico (@tonidero)
* Improve offline entitlements logs to mention limitations of this mode
(#1039) via Toni Rico (@tonidero)
* Improve error message when backend returns internal error code (#1038)
via Toni Rico (@tonidero)
* PurchaseTester: Add new UI to configure internal proxy behavior
(#1016) via Toni Rico (@tonidero)
* Updated readme to include links to migration guides (#1021) via Marcos
Castany (@mcastany)
* Store offerings response in SharedPreferences (#1028) via Toni Rico
(@tonidero)
* Refactor offerings code out of Purchases (#1027) via Toni Rico
(@tonidero)

---------

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants