Fetch offline entitlement mappings through Remote Config#3817
Conversation
c9ef677 to
1f6c9c2
Compare
| @@ -101,23 +109,51 @@ internal class OfflineEntitlementsManager( | |||
| fun updateProductEntitlementMappingCacheIfStale(completion: ((PurchasesError?) -> Unit)? = null) { | |||
| if (isOfflineEntitlementsEnabled() && deviceCache.isProductEntitlementMappingCacheStale()) { | |||
There was a problem hiding this comment.
This method will fetch the PEM from the legacy implementation only when the remote config one fails / is not available. However it could happen that it is fetched successfully, but remote config is disabled in a later stage.
If we want to tackle this as well I guess we'd have to always fetch it from the legacy system still?
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3817 +/- ##
==========================================
+ Coverage 80.43% 80.47% +0.03%
==========================================
Files 408 409 +1
Lines 16890 16953 +63
Branches 2467 2479 +12
==========================================
+ Hits 13586 13643 +57
Misses 2342 2342
- Partials 962 968 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3cf50d1 to
3df4441
Compare
tonidero
left a comment
There was a problem hiding this comment.
Still reviewing but looking great! Just left some initial comments
| @OptIn(InternalRevenueCatAPI::class) | ||
| internal class ProductEntitlementMappingResult( | ||
| val mapping: ProductEntitlementMapping, | ||
| private val useIfCurrent: ((ProductEntitlementMapping) -> Unit) -> Boolean, |
There was a problem hiding this comment.
Hmm TBH, I'm wondering if we need to be so careful specially for PEM... Note that PEM does not change per user + we would trigger a new fetch immediately after changing the user that would override it, so the window of error is quite narrow. I guess this makes it a bit safer, but just wondering if it's worth the extra complexity TBH...
3cf50d1 to
40b147f
Compare
(Don't merge before backend is ready)
Android equivalent of iOS PR RevenueCat/purchases-ios#7265
Description
Implements fetching the
ProductEntitlementMappingthrough the remote config infrastructure. This will only be done when remote config is enabled. And will still fall back to the existing implementation when remote config is disabled through the kill-switch.There's still an open question around handling the fallback if the kill-switch is activated later here