Make close() method also clear the shared instance of the SDK#2940
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2940 +/- ##
=======================================
Coverage 78.82% 78.82%
=======================================
Files 337 337
Lines 13129 13129
Branches 1771 1771
=======================================
Hits 10349 10349
Misses 2038 2038
Partials 742 742 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
vegaro
reviewed
Dec 16, 2025
vegaro
left a comment
Member
There was a problem hiding this comment.
I think the behavior change is fine because it wouldn't work anyways right?
Contributor
Author
Indeed, I think it should be fine... I guess before this, you could continue doing some operations with the SDK if you had some cached values, but it's indeed in an inconsistent state, so I think normally the changes of this PR include how it should behave |
vegaro
approved these changes
Dec 17, 2025
📸 Snapshot Test569 unchanged
🛸 Powered by Emerge Tools |
This was referenced Dec 17, 2025
tonidero
added a commit
that referenced
this pull request
Dec 18, 2025
## RevenueCat SDK ### ✨ New Features * Adds `setAppsFlyerConversionData` to conveniently track AppsFlyer conversion data (#2931) via JayShortway (@JayShortway) ### 🐞 Bugfixes * Make close() method also clear the shared instance of the SDK (#2940) via Toni Rico (@tonidero) * Fix purchase callback not firing for DEFERRED product changes with baePlanId in oldProductId (#2937) via Facundo Menzella (@facumenzella) ### 🔄 Other Changes * [AUTOMATIC] Update golden test files for backend integration tests (#2949) via RevenueCat Git Bot (@RCGitBot) * [AUTOMATIC] Update golden test files for backend integration tests (#2944) via RevenueCat Git Bot (@RCGitBot) * Adds `.kotlin` to `.gitignore` (#2941) via JayShortway (@JayShortway) * Dont use reflection to instantiate AmazonOfferingParser (#2934) via Will Taylor (@fire-at-will) --------- Co-authored-by: revenuecat-ops <ops@revenuecat.com> Co-authored-by: Toni Rico <toni.rico.diez@revenuecat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When calling the
closefunction, we cleared a bunch of internal state that leaves the SDK in an inconsistent state. Specifically, we clear the billing client from the BillingWrapper, among other things. If after that, you tried to reconfigure the SDK with the exact same configuration, it wouldn't let you, since we have logic to prevent reconfigurations with the same config. This means that in some cases, we would end up in this inconsistent state, without a great way to get out of it.I think the
closefunction means the instance shouldn't be called more, so we should also clear the shared instance, so we can actually reinitialize later if needed andPurchases.isConfiguredis false. This is however a behavior change.