fix: fallback to external browser when Custom Tabs unavailable

This commit is contained in:
edde746
2026-02-16 04:21:44 +01:00
parent 3dde8334e0
commit c3b10d6c45
+7 -1
View File
@@ -156,7 +156,13 @@ class _AuthScreenState extends State<AuthScreen> {
if (await canLaunchUrl(uri)) {
// On TV, use inAppWebView (simpler WebView) instead of Chrome Custom Tabs
final mode = PlatformDetector.isTV() ? LaunchMode.inAppWebView : LaunchMode.inAppBrowserView;
await launchUrl(uri, mode: mode);
try {
await launchUrl(uri, mode: mode);
} catch (_) {
// Chrome Custom Tabs may not be available (e.g. no Chrome installed).
// Fall back to opening in the default external browser.
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
} else {
throw Exception(t.errors.couldNotLaunchUrl);
}