Skip to content

Custom entitlements: add README and other improvements#1167

Merged
aboedo merged 26 commits into
mainfrom
andy/custom_entitlements_add_readme
Jul 24, 2023
Merged

Custom entitlements: add README and other improvements#1167
aboedo merged 26 commits into
mainfrom
andy/custom_entitlements_add_readme

Conversation

@aboedo

@aboedo aboedo commented Jul 21, 2023

Copy link
Copy Markdown
Member

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

@aboedo aboedo self-assigned this Jul 21, 2023
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment on lines 94 to 99

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we should add the exact code to catch:

  • receipt already in use
  • payment pending
  • purchase cancelled
  • product already purchased

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.

Hmm they could check the PurchasesTransactionException.error.errorCode and check for the following error codes:

  • PurchasesErrorCode.ProductAlreadyPurchasedError
  • PurchasesErrorCode.PurchaseCancelledError: though it's easier to just use the userCancelled property.
  • 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...

Comment thread examples/CustomEntitlementComputationSample/README.md Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not sure why this was 6.5.0

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.

I'm guessing since it is using the local version (in settings.gradle), it doesn't really matter?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

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.

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.

Comment thread examples/CustomEntitlementComputationSample/gradle/libs.versions.toml Outdated
@aboedo aboedo added the pr:feat A new feature label Jul 21, 2023
@aboedo aboedo requested review from tonidero and vegaro July 21, 2023 22:58
@codecov

codecov Bot commented Jul 21, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1167 (205bd91) into main (192326b) will increase coverage by 0.02%.
The diff coverage is n/a.

@@            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              
Impacted Files Coverage Δ
...com/revenuecat/purchases/PurchasesConfiguration.kt 88.33% <ø> (ø)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@aboedo aboedo force-pushed the andy/custom_entitlements_add_readme branch from 7ee0c1b to ce6f417 Compare July 24, 2023 14:23
@vegaro vegaro marked this pull request as ready for review July 24, 2023 16:53
@vegaro vegaro requested a review from a team July 24, 2023 16:54
@vegaro vegaro changed the title Custom entitlements: add README Custom entitlements: add README and other improvements Jul 24, 2023

@tonidero tonidero 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.

Looks great, left a few comments, but nothing blocking

Comment thread examples/CustomEntitlementComputationSample/settings.gradle Outdated
Comment thread examples/CustomEntitlementComputationSample/Sample screenshot.png
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
### 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.

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.

like when a subscription is renewed

This is not true for Android. Maybe we should mention this will only update on purchases. cc @aboedo

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, good call, we should update

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also, customerInfoStream is not a thing in Android. I will update

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

check it out and let me know what you think

Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/gradle/libs.versions.toml Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
Comment thread examples/CustomEntitlementComputationSample/README.md Outdated
### 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, good call, we should update

) {
Column {

Column(modifier = Modifier.fillMaxWidth().padding(32.dp)) {

@vegaro vegaro Jul 24, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Updated this because the width changed when the list got it first item. It got wider because the content was wider and had a weird spacing, like in this screenshot:

image

vegaro and others added 10 commits July 24, 2023 19:37
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>
@aboedo aboedo merged commit 66e1566 into main Jul 24, 2023
@aboedo aboedo deleted the andy/custom_entitlements_add_readme branch July 24, 2023 19:08
aboedo added a commit that referenced this pull request Jul 24, 2023
**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>
tonidero pushed a commit that referenced this pull request Jul 25, 2023
### 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants