Hi,
In my SwiftUI app, I manage the app state with enums, and the paywall only presents to the user when I set the value of uiState to .displayPaywall.
When this happens, the following code runs:
case .displayPaywall(let uuid):
PaywallView {
viewModel.retry()
}
.presentPaywallIfNeeded(
requiredEntitlementIdentifier: "premium") { _ in
viewModel.fetchLandmarkInfoIfAllowed()
}
}
And this is the PaywallView. The idea being that if the user dismisses the Paywall by clicking the X button, I show a simple message and a button that should supposedly trigger the Paywall view again:
struct PaywallView: View {
let onRetry: () -> Void
var body: some View {
VStack {
Text("Max free daily limit reached. Upgrade to Premium for unlimited use.")
.multilineTextAlignment(.center)
.padding()
Button("Retry") {
onRetry()
}
}
}
}
The issue I am facing now is that since RevenueCat SDK takes care of all the logic of whether Paywall should be presented or not, I can’t find a way to trigger the Paywall again with the click of a button.
Once the retry() is fired, I just want the Paywall to come back up. By current logic, the user needs to restart the app to see the Paywall again, which is not ideal at all.