Skip to content

Create CustomerCenterListener#2199

Merged
vegaro merged 16 commits into
mainfrom
cc-216-callback-with-actions
Mar 4, 2025
Merged

Create CustomerCenterListener#2199
vegaro merged 16 commits into
mainfrom
cc-216-callback-with-actions

Conversation

@vegaro

@vegaro vegaro commented Feb 26, 2025

Copy link
Copy Markdown
Member

This will allow developers to listen to events that occur inside the Customer Center

@vegaro

vegaro commented Feb 26, 2025

Copy link
Copy Markdown
Member Author

@RevenueCat/coresdk can you please take a look at this draft, I would like to make sure I get the public stuff right before continuing implementing.

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

I wonder if there is anything we can do to make the interface in kotlin... Probably not the end of the world though. Looking good!

* The listener is responsible for handling actions that happened in the Customer Center.
* Make sure [removeCustomerCenterListener] is called when the listener needs to be destroyed.
*/
var customerCenterListener: CustomerCenterListener?

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 wonder if we would want to support multiple listeners... But then again, this is the API we have for the CustomerInfo, so it might make more sense to be consistent 👍

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.

If someone really needs this they could build a listener that forwards to multiple other listeners themselves. Maybe something we can share as a recipe if we get a few requests.

Comment thread purchases/src/defaults/kotlin/com/revenuecat/purchases/Purchases.kt Outdated
@emerge-tools

emerge-tools Bot commented Feb 27, 2025

Copy link
Copy Markdown

📸 Snapshot Test

5 modified, 240 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
0 0 5 0 240 0 ✅ Approved

🛸 Powered by Emerge Tools

@vegaro vegaro force-pushed the cc-216-callback-with-actions branch from 5fc0c06 to 0bce4b8 Compare February 28, 2025 13:25
@vegaro vegaro marked this pull request as ready for review March 3, 2025 11:01
@vegaro vegaro requested review from a team March 3, 2025 11:01
@codecov

codecov Bot commented Mar 3, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 80.42%. Comparing base (82a9f29) to head (f17991d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...purchases/customercenter/CustomerCenterListener.kt 0.00% 5 Missing ⚠️
.../com/revenuecat/purchases/PurchasesOrchestrator.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2199      +/-   ##
==========================================
- Coverage   80.47%   80.42%   -0.06%     
==========================================
  Files         277      278       +1     
  Lines        9461     9467       +6     
  Branches     1336     1336              
==========================================
  Hits         7614     7614              
- Misses       1287     1293       +6     
  Partials      560      560              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@vegaro vegaro enabled auto-merge (squash) March 3, 2025 12:46

@JayShortway JayShortway left a comment

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.

Awesome! Really glad how this turned out! Just a suggestion.

Comment thread purchases/build.gradle
* The listener is responsible for handling actions that happened in the Customer Center.
* Make sure [removeCustomerCenterListener] is called when the listener needs to be destroyed.
*/
var customerCenterListener: CustomerCenterListener?

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.

If someone really needs this they could build a listener that forwards to multiple other listeners themselves. Maybe something we can share as a recipe if we get a few requests.

Comment thread purchases/src/defaults/kotlin/com/revenuecat/purchases/Purchases.kt Outdated
vegaro added 6 commits March 4, 2025 14:26
# Conflicts:
#	examples/paywall-tester/src/main/java/com/revenuecat/paywallstester/MainApplication.kt
#	examples/paywall-tester/src/main/java/com/revenuecat/paywallstester/ui/screens/main/appinfo/AppInfoScreen.kt
#	ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/customercenter/data/CustomerCenterViewModelTests.kt
vegaro added 2 commits March 4, 2025 19:05
# Conflicts:
#	ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/customercenter/data/CustomerCenterViewModelTests.kt
@vegaro vegaro merged commit 8a1275a into main Mar 4, 2025
@vegaro vegaro deleted the cc-216-callback-with-actions branch March 4, 2025 18:58
tonidero added a commit that referenced this pull request Mar 6, 2025
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* Add `hasPaywall` property to `Offering` (#2212) via Antonio Pallares
(@ajpallares)
### 🐞 Bugfixes
* Fix empty options in NoActive subscriptions screen (#2168) via Cesar
de la Vega (@vegaro)

## RevenueCatUI SDK
### Customer Center
#### ✨ New Features
* Create `CustomerCenterListener` (#2199) via Cesar de la Vega (@vegaro)
#### 🐞 Bugfixes
* Reload Customer Center after a successful restore (#2203) via Cesar de
la Vega (@vegaro)
* Fixes CustomerCenter state not refreshing when reopening (#2202) via
Cesar de la Vega (@vegaro)

### 🔄 Other Changes
* Improves PaywallsTester multi-API-key support (#2218) via JayShortway
(@JayShortway)
* [EXTERNAL] Bump Emerge Gradle Plugin and Snaphsots version (#2211) via
@runningcode (#2217) via JayShortway (@JayShortway)
* [AUTOMATIC][Paywalls V2] Updates Compose previews of all templates
(#2207) via RevenueCat Git Bot (@RCGitBot)
* [Paywalls V2] Enables template previews again (#2215) via JayShortway
(@JayShortway)
* Adds support for switching between 2 API keys to PaywallsTester
(#2213) via JayShortway (@JayShortway)
* Adds a `LocalPreviewImageLoader` `CompositionLocal`. (#2201) via
JayShortway (@JayShortway)
* Logs from RevenueCatUI are now tagged with `[Purchases]` too. (#2206)
via JayShortway (@JayShortway)
* [Paywalls V2] Ignores template previews for now. (#2209) via
JayShortway (@JayShortway)
* [Paywalls V2] Some more template previews optimizations (#2208) via
JayShortway (@JayShortway)
* chore: Delete key from customer center survey event (#2204) via
Facundo Menzella (@facumenzella)
* [Paywalls V2] Extract ImageLoader to use a single one (#2146) via Toni
Rico (@tonidero)
* [Paywalls V2] Adds progress indicator to buttons (#2198) via
JayShortway (@JayShortway)
* Avoids triggering "unscheduled" workflows when triggering workflows
via the CircleCI API (#2200) via JayShortway (@JayShortway)
* [Paywalls V2] Adds a note on publishing to the missing paywall error.
(#2193) via JayShortway (@JayShortway)
* Adds X-Kotlin-Version header. (#2197) via JayShortway (@JayShortway)
* [Paywalls V2] Adds docs on ignored arguments for Paywalls V2 in more
places. (#2195) via JayShortway (@JayShortway)
* chore: Add backend integration test for events (#2189) via Facundo
Menzella (@facumenzella)
* [Paywalls V2] Adds CI job to update template previews (#2192) via
JayShortway (@JayShortway)

---------

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Co-authored-by: Cesar de la Vega <cesarvegaro@gmail.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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants