Skip to content

Conversation

JayShortway
Copy link
Member

@JayShortway JayShortway commented Jul 9, 2025

Description

Codex started this, but I did most of the work sooooo.

  • Removes data classes from public API, and replaces with @Poko.
  • Manually wrote an internal copy() function if we were using it ourselves.
  • Adds detekt rule to guard against using data classes in the public API.

The diff is rather large, but most of it is very low in complexity.

@@ -21,7 +21,7 @@ constraintlayout = "1.1.0"
coroutines = "1.6.4"
datastorePreference = "1.0.0"
dependencyGraph = "0.9"
detekt = "1.23.6"
detekt = "1.23.8"
Copy link
Member Author

Choose a reason for hiding this comment

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

This is built against Kotlin 2.0.21.

https://detekt.dev/changelog#1238---2025-02-20

@Serializable
data class EventsRequest internal constructor(
internal class EventsRequest internal constructor(
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: made this internal.

@@ -10,7 +10,7 @@ internal object VariableProcessor {
/**
* Information necessary for computing variables.
*/
data class PackageContext(
internal data class PackageContext(
Copy link
Member Author

@JayShortway JayShortway Jul 9, 2025

Choose a reason for hiding this comment

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

Made this internal instead of removing data. The parent VariableProcessor is already internal, but detekt still failed.

@JayShortway JayShortway changed the title Remove data classes from API Removes data classes from public API Jul 9, 2025
@JayShortway JayShortway added pr:breaking Changes that are breaking and removed pr:other labels Jul 9, 2025
Comment on lines +25 to +26
LongParameterList:
ignoreAnnotated: [ 'Poko' ]
Copy link
Member Author

Choose a reason for hiding this comment

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

LongParameterList seems to automatically ignore data classes, so I made it ignore @Poko-annotated classes too.

Comment on lines +34 to +35
LibraryEntitiesShouldNotBePublic:
active: false
Copy link
Member Author

Choose a reason for hiding this comment

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

This rule basically flags everything that is public. The idea is that the public classes are in a dedicated api or public package (or the non-public ones are in an internal package). You could then exclude that package from this rule. We don't have our code organized like that, so for now I disabled the rule.

@@ -66,13 +58,8 @@ package com.revenuecat.purchases.ui.revenuecatui {
method public default void onRestoreStarted();
}

public final class PaywallOptions {
@androidx.compose.runtime.Immutable @dev.drewhamilton.poko.Poko public final class PaywallOptions {
Copy link
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 some of the @Immutable ones weren't picked up earlier.

Copy link

codecov bot commented Jul 9, 2025

Codecov Report

Attention: Patch coverage is 28.94737% with 54 lines in your changes missing coverage. Please review.

Project coverage is 77.93%. Comparing base (359de61) to head (205324e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...n/com/revenuecat/purchases/paywalls/PaywallData.kt 0.00% 51 Missing ⚠️
...s/customercenter/CustomerCenterManagementOption.kt 0.00% 2 Missing ⚠️
...evenuecat/purchases/common/events/EventsRequest.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2498      +/-   ##
==========================================
- Coverage   78.30%   77.93%   -0.37%     
==========================================
  Files         286      286              
  Lines       10512    10572      +60     
  Branches     1485     1485              
==========================================
+ Hits         8231     8239       +8     
- Misses       1635     1687      +52     
  Partials      646      646              

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

@JayShortway JayShortway requested a review from a team July 9, 2025 14:57
…-api

# Conflicts:
#	purchases/api-defauts.txt
#	purchases/api-entitlement.txt
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

Amazing getting rid of all these!!

import com.revenuecat.purchases.paywalls.PaywallData

@Suppress("LongParameterList")
internal fun Offering.copy(
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I see we have some copy methods in the purchases module, with a @InternalRevenueCat annotation... Would it be worth doing the same for these ones? Not sure if they might be useful there at some point... In any case, not a blocker, I'm also ok with this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm a bit in the middle on this haha. It can't really hurt, but on the other hand it would add it to our "public" API (makes it more visible in auto complete and stuff, even with required opt-in). We can also move it when we end up needing it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup! I'm fine with that 👍

@JayShortway JayShortway added this pull request to the merge queue Jul 10, 2025
@JayShortway JayShortway removed this pull request from the merge queue due to a manual request Jul 10, 2025
…-api

# Conflicts:
#	purchases/api-defauts.txt
#	purchases/api-entitlement.txt
#	ui/revenuecatui/api.txt
…from-public-api

# Conflicts:
#	purchases/api-defauts.txt
#	purchases/api-entitlement.txt
@JayShortway JayShortway enabled auto-merge July 10, 2025 12:54
@JayShortway JayShortway added this pull request to the merge queue Jul 10, 2025
@JayShortway JayShortway removed this pull request from the merge queue due to a manual request Jul 10, 2025
…-api

# Conflicts:
#	purchases/api-defauts.txt
#	purchases/api-entitlement.txt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/PaywallColor.kt
@JayShortway JayShortway enabled auto-merge July 10, 2025 14:24
@JayShortway JayShortway added this pull request to the merge queue Jul 10, 2025
Merged via the queue into main with commit 22ffba3 Jul 10, 2025
14 checks passed
@JayShortway JayShortway deleted the kxua03-codex/remove-data-classes-from-public-api branch July 10, 2025 15:10
@tonidero tonidero mentioned this pull request Jul 10, 2025
tonidero added a commit that referenced this pull request Jul 10, 2025
## RevenueCat SDK
This release updates the SDK to use Google Play Billing Library 8. This
version of the Billing Library removed APIs to query for expired
subscriptions and consumed one-time products, aside from other
improvements. You can check the full list of changes here:
https://developer.android.com/google/play/billing/release-notes#8-0-0

Additionally, we've also updated Kotlin to 2.0.21 and our new minimum
version is Kotlin 1.8.0+. If you were using an older version of Kotlin,
you will need to update it.

Regarding API changes, we've also removed data classes from our public
APIs. This means that for classes that were previously data classes, the
`copy` function and `componentN` functions (destructuring declarations)
have been removed. `equals` and `hashCode` functions still work as
before.

### Play Billing Library 8: No expired subscriptions or consumed
one-time products

**Note:** the following is only relevant if you recently integrated
RevenueCat, and do not (yet) have all your transactions imported.
  
Play Billing Library 8 removed functionality to query expired
subscriptions or consumed one-time products. This means that, for users
migrating from a non-RevenueCat implementation of the Play Billing
Library, the SDK will not be able to send purchase information from
these purchases. We can still ingest historical data from these
purchases through a backend historical import. See
[docs](https://www.revenuecat.com/docs/migrating-to-revenuecat/migrating-existing-subscriptions).
This doesn't affect developers that have all transactions in RevenueCat,
which is true for the vast majority.

### Bumped minimum Kotlin version

RevenueCat SDK v9 bumps Kotlin to 2.0.21, with a minimum Kotlin version
of 1.8.0.

### Using the SDK with your own IAP code (previously Observer Mode)

Using the SDK with your own IAP code is still supported in v9. Other
than updating the SDK version, there are no changes required. Just make
sure the version of the Play Billing Library is also version 8.0.0+.

### 💥 Breaking Changes
* Removes data classes from public API (#2498) via JayShortway
(@JayShortway)
* Marks `PaywallData` and `PaywallColor` as `InternalRevenueCatAPI`.
(#2507) via JayShortway (@JayShortway)
* BC8 migration (#2506) via Toni Rico (@tonidero)
* Update to kotlin 2.0.21 while keeping language compatibility (#2493)
via Toni Rico (@tonidero)

### 🔄 Other Changes
* Update CustomEntitlementComputation sample app kotlin version (#2510)
via Toni Rico (@tonidero)
* Fix `Switch` component previews (#2509) via Toni Rico (@tonidero)
* Add V9 migration guide (#2508) via Toni Rico (@tonidero)
* [AUTOMATIC][Paywalls V2] Updates paywall-preview-resources submodule
(#2499) via RevenueCat Git Bot (@RCGitBot)

---------

Co-authored-by: JayShortway <29483617+JayShortway@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codex pr:breaking Changes that are breaking pr:other
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants