Skip to content

Commit

Permalink
Merge pull request #243 from privacybydesign/new_url_launcher
Browse files Browse the repository at this point in the history
chore: launch is deprecated, use launchUrl
  • Loading branch information
bobhageman authored Oct 2, 2023
2 parents 8431d43 + c1fec35 commit 6b84c67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Upgraded to Flutter 3.13.5
- Upgraded macos runner version to 13 in Github actions
- Added open.yivi.app to associated domains
- Use launchUrl instead of launch from url_launcher since the latter is deprecated
- Upgraded packages and fixed various analyzer warnings

## [7.5.0] - 2023-09-13
Expand Down
8 changes: 6 additions & 2 deletions lib/src/data/irma_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,9 @@ class IrmaRepository {
if (Platform.isAndroid) {
await _iiabchannel.invokeMethod('open_browser', url);
} else {
final hasOpened = await launch(url, forceSafariVC: true);
final uri = Uri.parse(url);
final hasOpened = await launchUrl(uri, mode: LaunchMode.inAppWebView);

// Sometimes launch does not throw an exception itself on failure. Therefore, we also check the return value.
if (!hasOpened) {
throw Exception('url could not be opened: $url');
Expand All @@ -583,7 +585,9 @@ class IrmaRepository {
_resumedFromBrowserSubject.add(true);
}
// On iOS, open Safari rather than Safari view controller
final hasOpened = await launch(url, forceSafariVC: false);
final uri = Uri.parse(url);
final hasOpened = await launchUrl(uri, mode: LaunchMode.externalApplication);

// Sometimes launch does not throw an exception itself on failure. Therefore, we also check the return value.
if (!hasOpened) {
throw Exception('url could not be opened: $url');
Expand Down

0 comments on commit 6b84c67

Please sign in to comment.