Custom entitlements: add README and other improvements#1167
Conversation
There was a problem hiding this comment.
we should add the exact code to catch:
- receipt already in use
- payment pending
- purchase cancelled
- product already purchased
There was a problem hiding this comment.
Hmm they could check the PurchasesTransactionException.error.errorCode and check for the following error codes:
PurchasesErrorCode.ProductAlreadyPurchasedErrorPurchasesErrorCode.PurchaseCancelledError: though it's easier to just use theuserCancelledproperty.PurchasesErrorCode.ReceiptAlreadyInUseError: I might be missing something but this one shouldn't happen I think? As in, we are posting purchases:- Performed through the app (which should only be for new purchases and so should never have this error)
- On app foreground, if we haven't synced the purchase before. In this case, it would fail silently to sync, so a user in this mode would never see this happening.
PurchasesErrorCode.PaymentPendingError: need to test to confirm this error happens...
There was a problem hiding this comment.
not sure why this was 6.5.0
There was a problem hiding this comment.
I'm guessing since it is using the local version (in settings.gradle), it doesn't really matter?
There was a problem hiding this comment.
It is outdated on MagicWeatherCompose, which is what I used as a base project for the sample. I am not sure why it's outdated there, but I guess it's an issue in the releasing scripts
There was a problem hiding this comment.
Both magic weather sample apps don't update their version automatically... We definitely should fix that, even if it's just pointing to the latest snapshot... I created a task here.
Codecov Report
@@ Coverage Diff @@
## main #1167 +/- ##
==========================================
+ Coverage 85.59% 85.61% +0.02%
==========================================
Files 179 180 +1
Lines 6121 6181 +60
Branches 918 919 +1
==========================================
+ Hits 5239 5292 +53
- Misses 540 547 +7
Partials 342 342
|
There was a problem hiding this comment.
@customEntitlementsComputation would be valid if we were publishing as a flavor, but we are publishing the flavor as a different artifact
implementation 'com.revenuecat.purchases:purchases-custom-entitlement-computation:6.8.0'
I would also remove the Gradle catalogs version and simply leave the standard nomenclature
There was a problem hiding this comment.
It is outdated on MagicWeatherCompose, which is what I used as a base project for the sample. I am not sure why it's outdated there, but I guess it's an issue in the releasing scripts
7ee0c1b to
ce6f417
Compare
tonidero
left a comment
There was a problem hiding this comment.
Looks great, left a few comments, but nothing blocking
| ### Observing changes to purchases: | ||
|
|
||
| To ensure that your app reacts to changes to subscriptions in real time, you can use `customerInfoStream`. This stream will only fire when new `customerInfo` is registered | ||
| in RevenueCat, like when a subscription is renewed. If there are no changes from the last value, it will not fire. This means it's not guaranteed to fire on every app open. |
There was a problem hiding this comment.
like when a subscription is renewed
This is not true for Android. Maybe we should mention this will only update on purchases. cc @aboedo
There was a problem hiding this comment.
yeah, good call, we should update
There was a problem hiding this comment.
also, customerInfoStream is not a thing in Android. I will update
There was a problem hiding this comment.
check it out and let me know what you think
| ### Observing changes to purchases: | ||
|
|
||
| To ensure that your app reacts to changes to subscriptions in real time, you can use `customerInfoStream`. This stream will only fire when new `customerInfo` is registered | ||
| in RevenueCat, like when a subscription is renewed. If there are no changes from the last value, it will not fire. This means it's not guaranteed to fire on every app open. |
There was a problem hiding this comment.
yeah, good call, we should update
| ) { | ||
| Column { | ||
|
|
||
| Column(modifier = Modifier.fillMaxWidth().padding(32.dp)) { |
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
**This is an automatic release.** ### New Features Introduced Custom Entitlements Computation mode. This is new library intended for apps that will do their own entitlement computation separate from RevenueCat. It's distributed as a separate artifact in Maven. Apps using this mode rely on webhooks to signal their backends to refresh entitlements with RevenueCat. See the [demo app for an example and usage instructions](https://github.com/RevenueCat/purchases-android/tree/main/examples/CustomEntitlementComputationSample). * Custom entitlements: add README and other improvements (#1167) via Andy Boedo (@aboedo) * Update Custom Entitlements Sample app (#1166) via Andy Boedo (@aboedo) * purchase coroutine (#1142) via Andy Boedo (@aboedo) * Add switchUser (#1156) via Cesar de la Vega (@vegaro) * CustomEntitlementsComputation: disable first listener callback when set (#1152) via Andy Boedo (@aboedo) * CustomEntitlementsComputation: Prevent posting subscriber attributes in post receipt (#1151) via Andy Boedo (@aboedo) * Fix `customEntitlementComputation` library deployment (#1169) via Toni Rico (@tonidero) * CustomEntitlementComputation: Configure method for customEntitlementComputation mode (#1168) via Toni Rico (@tonidero) * Add publish system for customEntitlementComputation package (#1149) via Cesar de la Vega (@vegaro) * Use purchase coroutine in CustomEntitlementComputationSample (#1162) via Cesar de la Vega (@vegaro) * Adds CustomEntitlementComputationSample (#1160) via Cesar de la Vega (@vegaro) * Fix tests in customEntitlementComputation after merges (#1161) via Toni Rico (@tonidero) * CustomEntitlementComputation: Remove custom entitlement computation flavor for amazon module (#1158) via Toni Rico (@tonidero) * CustomEntitlementComputation: Generate dokka docs only for defaults flavor (#1159) via Toni Rico (@tonidero) * CustomEntitlementComputation: Create different PurchasesConfiguration that requires an appUserId parameter (#1154) via Toni Rico (@tonidero) * CustomEntitlementComputation: New Purchases class (#1153) via Toni Rico (@tonidero) * CustomEntitlementComputation: Disable automatic cache refresh (#1157) via Toni Rico (@tonidero) * Add `customEntitlementComputation` flavor (#1147) via Toni Rico (@tonidero) * Make `customEntitlementComputation` singular (#1148) via Toni Rico (@tonidero) * Disable offline entitlements in custom entitlements computation mode (#1146) via Toni Rico (@tonidero) * Remove integration test flavor (#1143) via Toni Rico (@tonidero) * Add header to requests when in custom entitlement computation mode (#1145) via Toni Rico (@tonidero) * Add internal customEntitlementsComputation mode to app config (#1141) via Toni Rico (@tonidero) ### New Coroutines * `awaitPurchase` is available as a coroutine-friendly alternative to `purchase()`. (#1142) via Andy Boedo (@aboedo) ### Dependency Updates * Bump fastlane from 2.213.0 to 2.214.0 (#1140) via dependabot[bot] (@dependabot[bot]) ### Other changes * CI: make all Codecov jobs informational (#1155) via Cesar de la Vega (@vegaro) * Creates PurchasesOrchestrator (#1144) via Cesar de la Vega (@vegaro) --------- Co-authored-by: revenuecat-ops <ops@revenuecat.com> Co-authored-by: Andy Boedo <andresboedo@gmail.com>
### New Features Introduced Custom Entitlements Computation mode. This is new library intended for apps that will do their own entitlement computation separate from RevenueCat. It's distributed as a separate artifact in Maven. Apps using this mode rely on webhooks to signal their backends to refresh entitlements with RevenueCat. See the [demo app for an example and usage instructions](https://github.com/RevenueCat/purchases-android/tree/main/examples/CustomEntitlementComputationSample). * Custom entitlements: add README and other improvements (#1167) via Andy Boedo (@aboedo) * Update Custom Entitlements Sample app (#1166) via Andy Boedo (@aboedo) * purchase coroutine (#1142) via Andy Boedo (@aboedo) * Add switchUser (#1156) via Cesar de la Vega (@vegaro) * CustomEntitlementsComputation: disable first listener callback when set (#1152) via Andy Boedo (@aboedo) * CustomEntitlementsComputation: Prevent posting subscriber attributes in post receipt (#1151) via Andy Boedo (@aboedo) * Fix `customEntitlementComputation` library deployment (#1169) via Toni Rico (@tonidero) * CustomEntitlementComputation: Configure method for customEntitlementComputation mode (#1168) via Toni Rico (@tonidero) * Add publish system for customEntitlementComputation package (#1149) via Cesar de la Vega (@vegaro) * Use purchase coroutine in CustomEntitlementComputationSample (#1162) via Cesar de la Vega (@vegaro) * Adds CustomEntitlementComputationSample (#1160) via Cesar de la Vega (@vegaro) * Fix tests in customEntitlementComputation after merges (#1161) via Toni Rico (@tonidero) * CustomEntitlementComputation: Remove custom entitlement computation flavor for amazon module (#1158) via Toni Rico (@tonidero) * CustomEntitlementComputation: Generate dokka docs only for defaults flavor (#1159) via Toni Rico (@tonidero) * CustomEntitlementComputation: Create different PurchasesConfiguration that requires an appUserId parameter (#1154) via Toni Rico (@tonidero) * CustomEntitlementComputation: New Purchases class (#1153) via Toni Rico (@tonidero) * CustomEntitlementComputation: Disable automatic cache refresh (#1157) via Toni Rico (@tonidero) * Add `customEntitlementComputation` flavor (#1147) via Toni Rico (@tonidero) * Make `customEntitlementComputation` singular (#1148) via Toni Rico (@tonidero) * Disable offline entitlements in custom entitlements computation mode (#1146) via Toni Rico (@tonidero) * Remove integration test flavor (#1143) via Toni Rico (@tonidero) * Add header to requests when in custom entitlement computation mode (#1145) via Toni Rico (@tonidero) * Add internal customEntitlementsComputation mode to app config (#1141) via Toni Rico (@tonidero) ### New Coroutines * `awaitPurchase` is available as a coroutine-friendly alternative to `purchase()`. (#1142) via Andy Boedo (@aboedo) ### Dependency Updates * Bump fastlane from 2.213.0 to 2.214.0 (#1140) via dependabot[bot] (@dependabot[bot]) ### Other changes * CI: make all Codecov jobs informational (#1155) via Cesar de la Vega (@vegaro) * Creates PurchasesOrchestrator (#1144) via Cesar de la Vega (@vegaro) --------- Co-authored-by: revenuecat-ops <ops@revenuecat.com> Co-authored-by: Andy Boedo <andresboedo@gmail.com>

Added the README file and did more cleanup on other tings.