Debug view: Initial UI + Usage in MagicWeatherCompose#1075
Conversation
There was a problem hiding this comment.
Had to update kotlin to 1.8 in this module, it didn't work even with 1.7.20 unless I downgraded compose a lot. Considering this is meant to be a new library, we can require Kotlin 1.8 I think.
There was a problem hiding this comment.
The release version of this composable does nothing.
Codecov Report
@@ Coverage Diff @@
## main #1075 +/- ##
=======================================
Coverage 85.92% 85.92%
=======================================
Files 181 181
Lines 6216 6216
Branches 899 899
=======================================
Hits 5341 5341
Misses 533 533
Partials 342 342 |
There was a problem hiding this comment.
This is so it doesn't warn us about compose preview functions being unused.
There was a problem hiding this comment.
Will need to leave this until the debug view has been deployed at least once
There was a problem hiding this comment.
The compiler version needs to match the kotlin version https://developer.android.com/jetpack/androidx/releases/compose-kotlin. And for 1.7.21, it needs to be 1.4.0-alpha02. It won't work with 1.4.0. The alternative here would be to downgrade to 1.7.20, which would match with compiler version 1.3.2... As for upgrading to kotlin 1.8, it would cause breaking changes, since it seems apps using kotlin 1.6 aren't really compatible due to some dependencies. Open to suggestions here... For now, I haven't had issues using the alpha version
There was a problem hiding this comment.
I'm commenting this out for now until I completely finish the debug view and is ready to be published as a separate package.
There was a problem hiding this comment.
Open to thoughts about the dependency name. I'm thinking something like this for the "debug" library and something like com.revenuecat.purchases:debugview-noop for the release version
There was a problem hiding this comment.
I think this is fine. I thought about only debug but that might imply other stuff like debug logs or something like that
There was a problem hiding this comment.
The bottom sheet APIs I'm using are marked as experimental, so I'm forced to opt in. This means there might be breaking changes at any point :(.
I thought about using Material instead of Material3 to do this, but the paradigm is quite different... In Material's version, you need to pass the UI below the bottom sheet as the content of the composable. IMO, that's not ideal, so I understand the new architecture they are using in Material3. In the end, I decided to go with Material3's version since it provides a much easier to use API and more modern UI as well.
There was a problem hiding this comment.
This is a debug thing so I think it's fine to do this.
There was a problem hiding this comment.
Still need to make offerings visible. My idea is to display them as alerts in a future PR. Navigation within bottom sheets requires additional experimental libraries on Google's side, so I wanted to avoid that for now.
There was a problem hiding this comment.
Haha this is basically just like @ViewBuilder.
There was a problem hiding this comment.
Yup it's super similar to SwiftUI :P
There was a problem hiding this comment.
Should this be com.revenuecat.purchases.ui maybe? Are you thinking of having a separate one for "future" UI? 👀
There was a problem hiding this comment.
Hmm maybe... I was thinking that for other ui projects, those would belong to other modules/dependencies, but maybe we could scope all those under ui. So maybe rename to com.revenuecat.purchases.ui.debugview. Wdyt?
There was a problem hiding this comment.
I will do this rename in a followup PR to avoid conflicts
There was a problem hiding this comment.
This is a debug thing so I think it's fine to do this.
vegaro
left a comment
There was a problem hiding this comment.
This looks very good! Good job!
There was a problem hiding this comment.
do you think this function should be toSettingGroupStates()?
There was a problem hiding this comment.
Should this be part of a viewModel or is it fine here? I am not that familiar
There was a problem hiding this comment.
I thought about it, unfortunately we don't have a view model for the MainScreen right now, so it was easier to move it here... But yeah, this is something that could be moved to a view model.
There was a problem hiding this comment.
I think this is fine. I thought about only debug but that might imply other stuff like debug logs or something like that
…1180) ### Description This reverts the changes in #1169, and additionally makes some changes so we only apply the maven publish plugin when using the `defaults` flavor in non-purchases modules. This should avoid having to have extra flavors in those modules and having them support the `customEntitlementComputation` flavor. This was becoming a bit of a problem as I was working in the debug view #1075. Since some of the functions I'm using aren't in the `customEntitlementComputation` flavor. I could have split the debug view library by flavor to make it compatible, but that seems like unnecessary work.
**This is an automatic release.** ### Bugfixes * Fix NoSuchElementException by using poll when accessing serviceRequests (#1190) via Cesar de la Vega (@vegaro) ### Other Changes * Debug view: rename package (#1191) via Toni Rico (@tonidero) * Debugview: Add snapshot tests for debug view using Paparazzi (#1187) via Toni Rico (@tonidero) * Debug view: Add offerings section and purchasing capabilities (#1186) via Toni Rico (@tonidero) * Debug view: Initial UI + Usage in MagicWeatherCompose (#1075) via Toni Rico (@tonidero) * Remove customEntitlementComputation flavor for non-purchases modules (#1180) via Toni Rico (@tonidero) Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Description
Same as was added in iOS in RevenueCat/purchases-ios#2567. Includes the changes in #1180
This PR adds a debug view in the Android SDK and uses it in the
MagicWeatherComposesample app. This debug view is meant to be a Jetpack compose function, even though later we might add convenience accessors for people not using jetpack compose. It's extracted to a different module so it can be published separately from the main SDK. It also attempts to keep all the code in the debug source set, to try to include as few code in the release variants.The provided API is currently 2 composable functions:
DebugRevenueCatDebugScreen: This is the actual UI that is part of the debug screen. In case devs want to use it in a custom UI.DebugRevenueCatBottomSheet: This will display the debug screen as a bottom sheet. This is what's used in theMagicWeatherComposesample app.TODO
Screen_recording_20230728_115505.mp4