-
Notifications
You must be signed in to change notification settings - Fork 83
Introduces CompatComposeView
to handle scenarios where the view tree is not set up
#2527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📸 Snapshot Test648 unchanged
🛸 Powered by Emerge Tools |
just tested this as an alternative fix to RevenueCat/react-native-purchases#1319 and it seems to work fine |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2527 +/- ##
=======================================
Coverage 78.10% 78.10%
=======================================
Files 286 286
Lines 10573 10573
Branches 1485 1485
=======================================
Hits 8258 8258
Misses 1668 1668
Partials 647 647 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work! Code looks low level, but it all seems to make sense in my mind! A few scenarios we should make sure work:
- In paywalls V1 footers, make sure the transition from loading to loaded states work correctly.
- Make sure memory, viewmodel and listeners (if any) are released when paywall view is removed from the view tree
- Localization works correctly (so if changing device locale, paywall is updated correctly)
Will mention more if I think of any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just we should make sure we test all hybrids with this new approach
I tested these:
And @vegaro tested the hybrids. All seems to work fine! |
* a modal in this case. | ||
*/ | ||
@Suppress("TooManyFunctions") | ||
@InternalRevenueCatAPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'm wondering if we should make this CompatComposeView
a child of PaywallView
and the others instead of making it a subclass... That way we wouldn't need to expose it. Having said I'm also ok leaving it like this! probably cleaner, even though it forces us to expose this API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean an inner class? I'm not sure if that would work either, because PaywallView
would still need to extend it, which makes it part of the API again.
If you mean child, it would be an empty view basically, right? It was written with the intention that it's the single root of a screen-level view. If it becomes a child it would be more brittle I think. (E.g. what happens if we accidentally add 2 children, at some point in the future when we've forgotten the details of how this works?)
Let me know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I meant children. As in, we could have the PaywallView/CustomerCenterView have an instance of this view, which in turn would have a compose view inside... But yeah, I think having it as a subclass makes sense! Just some random thoughts I had 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh got it, thanks! Yea I think having it as a superclass is simpler for now. We can always change it, as we "provide no guarantees" for @InternalRevenueCatAPI
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this with the hybrids and seems to work fine
**This is an automatic release.** ## RevenueCat SDK ### Virtual Currency #### ✨ New Features * Virtual Currency Support (#2519) via Will Taylor (@fire-at-will) ## RevenueCatUI SDK ### Paywallv2 #### ✨ New Features * PaywallActivityLauncher: Add `edgeToEdge` parameter to display paywall in full screen (#2530) via Toni Rico (@tonidero) #### 🐞 Bugfixes * Remove logic to avoid repurchasing already subscribed products (#2492) via Toni Rico (@tonidero) ### 🔄 Other Changes * Dont run VC tests on load shedder integration tests (#2538) via Will Taylor (@fire-at-will) * Introduces `CompatComposeView` to handle scenarios where the view tree is not set up (#2527) via JayShortway (@JayShortway) Co-authored-by: revenuecat-ops <ops@revenuecat.com>
…e is not set up (#2527) ## Description This opens the door to showing `PaywallView` in a new Window, instead of in an Activity. It should also fix a few crashes we've been seeing in react-native-purchases, when the Paywall is shown modally. There's an explainer added to the documentation of `CompatComposeView`.
Description
This opens the door to showing
PaywallView
in a new Window, instead of in an Activity. It should also fix a few crashes we've been seeing in react-native-purchases, when the Paywall is shown modally.There's an explainer added to the documentation of
CompatComposeView
.