Skip to content

Conversation

fire-at-will
Copy link
Contributor

@fire-at-will fire-at-will commented Jul 17, 2025

Description

This PR exposes the VirtualCurrency and VirtualCurrencies constructors publicly behind the @InternalRevenueCatAPI annotation. This will help us in a few scenarios when we need to instantiate VC objects outside of purchases-android, including in the mapper tests in PHC.

Other Approaches Considered

We considered a few other approaches before deciding to use @InternalRevenueCatAPI:

  • Making the constructor public without an annotation. This works, but isn't ideal for a few reasons:
    • Adding new properties would be a breaking change unless we used the @JvmOverloads annotation. Even then, we would need to provide a default value, and that won't always be easy (e.g. when we add VC icons, these will likely not be optionals)
    • Parsing the VC objects from JSON in the PHC mapper tests. This would work but feels a little dirty, and wouldn't help us if we ever need to do this in other circumstances.

Using @InternalRevenueCatAPI allows us to access the constructor outside of purchases-android while still giving us the freedom to make breaking changes to the constructor in the future.

@fire-at-will fire-at-will self-assigned this Jul 17, 2025
@fire-at-will fire-at-will added the pr:feat A new feature label Jul 17, 2025
@fire-at-will
Copy link
Contributor Author

@RCGitBot please test

@fire-at-will fire-at-will enabled auto-merge July 17, 2025 15:16
@fire-at-will fire-at-will disabled auto-merge July 17, 2025 15:17
@fire-at-will fire-at-will enabled auto-merge July 17, 2025 15:28
@fire-at-will fire-at-will disabled auto-merge July 17, 2025 15:28
@fire-at-will fire-at-will enabled auto-merge July 17, 2025 15:29
@fire-at-will fire-at-will added this pull request to the merge queue Jul 17, 2025
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.26%. Comparing base (9118fcd) to head (8f64ba0).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2543   +/-   ##
=======================================
  Coverage   78.26%   78.26%           
=======================================
  Files         291      291           
  Lines       10782    10782           
  Branches     1507     1507           
=======================================
  Hits         8439     8439           
  Misses       1691     1691           
  Partials      652      652           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Merged via the queue into main with commit ec2ddf4 Jul 17, 2025
14 checks passed
@fire-at-will fire-at-will deleted the make-vc-inits-public branch July 17, 2025 16:03
@fire-at-will fire-at-will added pr:other pr:force_patch Forces a patch release and removed pr:feat A new feature labels Jul 17, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jul 17, 2025
**This is an automatic release.**

### 🔄 Other Changes
* [AUTOMATIC][Paywalls V2] Updates paywall-preview-resources submodule
(#2544) via RevenueCat Git Bot (@RCGitBot)
* Expose Virtual Currency Constructors with @InternalRevenueCatAPI
(#2543) via Will Taylor (@fire-at-will)
* Expose API key validation result to BillingFactory (#2542) via Toni
Rico (@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
tonidero pushed a commit that referenced this pull request Aug 25, 2025
### Description
This PR exposes the `VirtualCurrency` and `VirtualCurrencies`
constructors publicly behind the `@InternalRevenueCatAPI` annotation.
This will help us in a few scenarios when we need to instantiate VC
objects outside of `purchases-android`, including in the mapper tests in
PHC.

#### Other Approaches Considered
We considered a few other approaches before deciding to use
`@InternalRevenueCatAPI`:
- Making the constructor public without an annotation. This works, but
isn't ideal for a few reasons:
- Adding new properties would be a breaking change unless we used the
`@JvmOverloads` annotation. Even then, we would need to provide a
default value, and that won't always be easy (e.g. when we add VC icons,
these will likely not be optionals)
- Parsing the VC objects from JSON in the PHC mapper tests. This would
work but feels a little dirty, and wouldn't help us if we ever need to
do this in other circumstances.

Using `@InternalRevenueCatAPI` allows us to access the constructor
outside of `purchases-android` while still giving us the freedom to make
breaking changes to the constructor in the future.
@tonidero tonidero mentioned this pull request Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:force_patch Forces a patch release pr:other
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants