Skip to content

Conversation

@MojtabaHs
Copy link

There are a bunch of methods to display the paywall, including:

  • Using the presentPaywallIfNeeded modifier
  • Building a PaywallView with configuration and presenting it manually
  • Building a PaywallView with arguments and presenting it manually
  • etc.

But only some of them have the ability to hide or show the closeButton since it is hardcoded into the PaywallView's initializer and cannot be reached from the helpers like the presentPaywallIfNeeded. Also, it is not how SwiftUI is designed.

So I have introduced a modifier called purchaseDisplayCloseButton so users can decide to hide/show the button anywhere they need to.

As an example, we can do this now:

.presentPaywallIfNeeded(
    requiredEntitlementIdentifier: Constants.ENTITLEMENT_ID,
    purchaseCompleted: { customerInfo in
        print("Purchase completed: \(customerInfo.entitlements)")
    },
    restoreCompleted: { customerInfo in
        // Paywall will be dismissed automatically if the entitlement is now active.
        print("Purchases restored: \(customerInfo.entitlements)")
    }
)
.purchaseDisplayCloseButton(false) // 👈 here is the modifier

I've also made it optional, so they can nil out this override to let the library use its default value if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant