Skip to content

Add switchUser#1156

Merged
vegaro merged 4 commits into
mainfrom
cesar/sdk-3224-switchuser-method
Jul 21, 2023
Merged

Add switchUser#1156
vegaro merged 4 commits into
mainfrom
cesar/sdk-3224-switchuser-method

Conversation

@vegaro

@vegaro vegaro commented Jul 20, 2023

Copy link
Copy Markdown
Member

This method allows you to change the cached app user id, but it doesn't fetch the customer info afterwards. It does fetch offerings though.

Here's the iOS equivalent

https://github.com/RevenueCat/purchases-ios/blob/598a76f18d4836573381ebd6a90140e5e24e07c1/Sources/Identity/IdentityManager.swift#L94

@vegaro vegaro added the pr:feat A new feature label Jul 20, 2023
@vegaro vegaro force-pushed the cesar/sdk-3224-switchuser-method branch from e2d7fe5 to 08144b9 Compare July 20, 2023 11:30
@codecov

codecov Bot commented Jul 20, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1156 (d9f09ad) into main (a81f73a) will decrease coverage by 0.06%.
The diff coverage is 67.92%.

❗ Current head d9f09ad differs from pull request most recent head 7a53f51. Consider uploading reports for the commit 7a53f51 to get more accurate results

@@            Coverage Diff             @@
##             main    #1156      +/-   ##
==========================================
- Coverage   85.65%   85.59%   -0.06%     
==========================================
  Files         178      178              
  Lines        6163     6166       +3     
  Branches      917      917              
==========================================
- Hits         5279     5278       -1     
- Misses        543      547       +4     
  Partials      341      341              
Impacted Files Coverage Δ
...in/com/revenuecat/purchases/listenerConversions.kt 13.63% <ø> (-20.74%) ⬇️
...revenuecat/purchases/CoroutinesExtensionsCommon.kt 80.00% <ø> (ø)
.../com/revenuecat/purchases/PurchasesOrchestrator.kt 82.32% <0.00%> (-0.63%) ⬇️
...om/revenuecat/purchases/strings/IdentityStrings.kt 0.00% <ø> (ø)
.../revenuecat/purchases/ListenerConversionsCommon.kt 62.50% <62.50%> (+7.95%) ⬆️
...n/com/revenuecat/purchases/coroutinesExtensions.kt 85.71% <85.71%> (ø)
...m/revenuecat/purchases/identity/IdentityManager.kt 97.53% <100.00%> (+0.09%) ⬆️

... and 2 files with indirect coverage changes

@vegaro vegaro marked this pull request as ready for review July 20, 2023 13:35
@vegaro vegaro requested a review from a team July 20, 2023 13:35

@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!

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.

Did you mean to remove this?

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 believe that was moved within the IdentityManager

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.

Exactly, I moved it to IdentityManager to resetAndSaveUserID

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.

👍🏻

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.

No tests? 😅

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 weird... This should actually be covered in the PurchasesLoginTests.... Not sure why codecov isn't getting that.

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.

Yeah I saw, weird.

@tonidero tonidero force-pushed the toniricodiez/sdk-3223-new-custom-entitlements-purchases-class branch from bf5776f to 85d6dc5 Compare July 20, 2023 14:39
@vegaro vegaro force-pushed the cesar/sdk-3224-switchuser-method branch from 933aea5 to d9f09ad Compare July 20, 2023 16:33

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 noticed, but we need to add this to the API tests for the customEntitlementComputation flavor.

Base automatically changed from toniricodiez/sdk-3223-new-custom-entitlements-purchases-class to main July 21, 2023 14:17
@vegaro vegaro force-pushed the cesar/sdk-3224-switchuser-method branch from d9f09ad to af19aa7 Compare July 21, 2023 14:53
@vegaro vegaro enabled auto-merge (squash) July 21, 2023 15:06
@vegaro vegaro merged commit a3d16be into main Jul 21, 2023
@vegaro vegaro deleted the cesar/sdk-3224-switchuser-method branch July 21, 2023 15:11
tonidero added a commit that referenced this pull request Jul 21, 2023
### Description
Fix tests after merges of #1142 and #1156 caused issue in main
This was referenced Jul 21, 2023
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.

4 participants