how to display launchUrl on top of the paywalls
I use example code as follows, the paywall is showing, when I click link event, it couldn’t invoke Browser to show url content, after view.dismiss(), it show. but I want to display url content on top of the paywall and do not dismiss paywall, How to implement it?
case OpenUrlAction(url: final url):
final Uri uri = Uri.parse(url);
//await view.dismiss();
final selectedAction = await view.showDialog(
title: 'Open URL?',
content: url,
primaryActionTitle: 'Cancel',
secondaryActionTitle: 'OK',
);
switch (selectedAction) {
case AdaptyUIDialogActionType.primary:
print('#Example# paywallViewDidPerformAction primaryAction');
break;
case AdaptyUIDialogActionType.secondary:
print('#Example# paywallViewDidPerformAction secondaryAction');
launchUrl(uri, mode: LaunchMode.inAppBrowserView);
break;
}
Comments1
Ebrar Berenay Yiğit
Mar 23
Hi, this is Berenay from Adapty Support 👋
The behavior you’re seeing happens because
LaunchMode.inAppBrowserViewuses SFSafariViewController (iOS) or Chrome Custom Tabs (Android), which needs to present from the current native view controller. However, the Adapty paywall is already the topmost presented native view, so the in-app browser cannot appear on top of it. This is a platform limitation, not a bug.Here are two approaches that work:
Simplest — use
externalApplicationmodeThis opens the system browser while keeping the paywall visible. No need to dismiss it:
case OpenUrlAction(url: final url): final Uri uri = Uri.parse(url); launchUrl(uri, mode: LaunchMode.externalApplication); break;The paywall stays intact when the user returns to the app.
No flicker or dismiss/re-create needed.
In-app browsing (less ideal UX)
If you must use in-app browsing, you need to dismiss the paywall first, open the browser, then re-present the paywall afterward:
case OpenUrlAction(url: final url): final Uri uri = Uri.parse(url); await view.dismiss(); await launchUrl(uri, mode: LaunchMode.inAppBrowserView); // Re-present the paywall after browser closes final newView = await AdaptyUI().createPaywallView( paywall: paywall, viewConfiguration: viewConfig, ); await newView.present(); break;Works, but introduces a brief flicker when the paywall is recreated.
Recommendation: Go with option 1 (
externalApplication), cleanest UX, no dismiss, paywall stays visible.Docs for reference:
Button actions
Event handling
Hope this helps!