-
Notifications
You must be signed in to change notification settings - Fork 335
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
Add UI Preview Mode to SDK #4693
Conversation
Generated by 🚫 Danger |
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.
Very clean and readable! 😗👌 Just 2 suggestions.
let productType = productTypes[index % productTypes.count] | ||
|
||
let introductoryDiscount: TestStoreProductDiscount? = { | ||
guard productType.period != nil && Bool.random() else { return nil } |
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.
I like the idea, but the randomness could add friction if you want to see a discount and all random()
s happen to be false. (You'll need to go back and reopen the preview / the app.)
What do you think about having a fixed (set of) product type(s) always having a discount, e.g. monthly
and yearly
?
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.
I totally see your point about the friction due to the randomness. I also believe that what we show in previews should be more deterministic.
On the other hand, I do imagine some clients wanting to show the exact information of their products on the previews. However, the introduced randomness does not solve this problem either.
WDYT @aboedo?
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.
I do imagine some clients wanting to show the exact information of their products on the previews.
Just for some context: this is something I believe we will do at some point. We could on top of that allow users to configure the preview before/when showing it, e.g. with a setting that controls discounts. However these are not solutions for in this PR haha.
This is not a blocker for me btw!
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.
Makes sense, I can imagine the frustration and the confusion if the paywall looks different between opens.
Agreed with Joop that eventually we'll want to get realistic data in there, but in the meantime probably the easiest way to go would be to have a way to tell the SDK what to show.
That way we could do something like what the dashboard does, where it allows you to select whether to preview with intro offer eligible or not.
Probably not something that needs to go into the MVP of this feature and can be added on later before shipping to prod.
And it will set us up nicely for doing something similar for Customer Center, where we'll inevitably need to find a way to select whether to show the CC as a user with an active subscription would see it vs empty subs
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.
Looking good! Just another comment of possible improvements to make the previews more realistic/more deterministic
] | ||
|
||
let products = productIdentifiers.enumerated().map { index, identifier -> StoreProduct in | ||
let productType = productTypes[index % productTypes.count] |
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.
I wonder if we could act a bit smarter here and instead of assigning basically a random period to each product, we could try to get the package type provided by the offerings (which has the duration). In case the package type is custom
, we could then do something "smart" like analyzing the product id for some keywords like week
, month
, year
.... To assign the duration. And then if we don't find any, as a fallback, assign a random period.
I'll open separate PRs for the new API for enabling the UI Preview mode and for the specific implementation details of this new mode |
See #4714 for the new API for the UI Preview mode |
Checklist
purchases-android
and hybridsMotivation
We need to add a specific mode for the SDK to allow Paywall Previews in the RevenueCat app
Description
The UI Preview Mode of the SDK should limit all the functionality of the SDK to only enable implementing the Paywall Previews functionality in the RevenueCat, so that developers can properly test their paywalls on their own devices.
This is currently a WIP, as it still only contains the changes implemented by @aboedo.