Skip to main content
Solved

PaywallDialog custom display logic is ignored


Forum|alt.badge.img+2

Hello,

I’m trying to use custom display logic in my android’s paywall dialog.

I use “setShouldDisplayBlock” according to the documentation, however it seems it’s being ignored.

Let’s use an exaggerated example:

val paywallDialogOptions = PaywallDialogOptions.Builder()    .setShouldDisplayBlock {        false    }   .setRequiredEntitlementIdentifier(PurchaseManager.premiumEntitlementId)    .build()PaywallDialog(paywallDialogOptions = paywallDialogOptions)

It should never be displayed according to the documentation, yet it’s being shown the moment the screen is open.

Did I get something wrong?

I created a simple project that it can be tested on - https://github.com/kmalyshev/purchases-paywall-problem. You’d need to add a revenuecat’s api key and the entitlement identifier

Best answer by sharif

Hi @simplesoft,

I am curious why you are calling setShouldDisplayBlock with setRequiredEntitlementIdentifier. Usually setShouldDisplayBlock is used when you have custom logic but setRequiredEntitlementIdentifier will display the paywall automatically if the entitlement is not active. It sounds like you should remove one of them to achieve the desired behavior? Remove setShouldDisplayBlock if you want the paywall to be displayed automatically or remove setRequiredEntitlementIdentifier if you want to display the paywall manually.

View original
Did this post help you find an answer to your question?
This post has been closed for comments

2 replies

sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • Answer
  • July 1, 2024

Hi @simplesoft,

I am curious why you are calling setShouldDisplayBlock with setRequiredEntitlementIdentifier. Usually setShouldDisplayBlock is used when you have custom logic but setRequiredEntitlementIdentifier will display the paywall automatically if the entitlement is not active. It sounds like you should remove one of them to achieve the desired behavior? Remove setShouldDisplayBlock if you want the paywall to be displayed automatically or remove setRequiredEntitlementIdentifier if you want to display the paywall manually.


Forum|alt.badge.img+2
  • Author
  • New Member
  • 2 replies
  • July 2, 2024

Hi Sharif,

Thank you for the comment, it resolved my issue, now it works as planned. I wasn’t aware that setRequiredEntitlementIdentifier overrides the logic, I misread the documentation for this line.

Thanks!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings