Skip to content

Commit

Permalink
An attempt to fix the blank external page (#5514)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k authored Jul 30, 2024
1 parent cc3756d commit 9ad3887
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions packages/smooth_app/lib/pages/navigator/external_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:path/path.dart' as path;
import 'package:smooth_app/helpers/launch_url_helper.dart';
import 'package:smooth_app/pages/navigator/app_navigator.dart';
import 'package:smooth_app/query/product_query.dart';
import 'package:smooth_app/services/smooth_services.dart';

/// This screen is only used for deep links!
///
Expand Down Expand Up @@ -58,19 +59,24 @@ class _ExternalPageState extends State<ExternalPage> {
url = '$url?lc=${language.offTag}';
}

if (Platform.isAndroid) {
await tabs.launchUrl(
Uri.parse(url),
customTabsOptions: const tabs.CustomTabsOptions(
showTitle: true,
),
);
} else {
await LaunchUrlHelper.launchURL(url);
}

if (mounted) {
AppNavigator.of(context).pop();
try {
if (Platform.isAndroid) {
WidgetsFlutterBinding.ensureInitialized();
await tabs.launchUrl(
Uri.parse(url),
customTabsOptions: const tabs.CustomTabsOptions(
showTitle: true,
),
);
} else {
await LaunchUrlHelper.launchURL(url);
}
} catch (e) {
Logs.e('Unable to open an external link', ex: e);
} finally {
if (mounted) {
AppNavigator.of(context).pop();
}
}
});
}
Expand Down

0 comments on commit 9ad3887

Please sign in to comment.