Solved

PaywallDialog custom display logic is ignored

  • 28 June 2024
  • 2 replies
  • 26 views

Badge +1

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

icon

Best answer by sharif 1 July 2024, 21:45

View original

This post has been closed for comments

2 replies

Userlevel 5
Badge +9

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.

Badge +1

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!