Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-standard protocol handling #1186

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions lib/utils/links.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,19 @@ void _openLink(BuildContext context, {required String url}) async {
),
);
} else if (state.browserMode == BrowserMode.inApp) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => WebView(url: url),
),
);
// Check if the scheme is not https, in which case the in-app browser can't handle it
Uri? uri = Uri.tryParse(url);
if (uri != null && uri.scheme != 'https') {
// Although a non-https scheme is an indication that this link is intended for another app,
// we actually have to change it back to https in order for the intent to be properly passed to another app.
url_launcher.launchUrl(uri, mode: url_launcher.LaunchMode.externalApplication);
} else {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => WebView(url: url),
),
);
}
}
}

Expand Down
Loading