-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch-url.patch
More file actions
29 lines (28 loc) · 966 Bytes
/
launch-url.patch
File metadata and controls
29 lines (28 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/lib/views/components/app_links.dart b/lib/views/components/app_links.dart
index dddfcd5..63eb035 100644
--- a/lib/views/components/app_links.dart
+++ b/lib/views/components/app_links.dart
@@ -1,3 +1,4 @@
+import 'dart:io';
import 'package:flutter/material.dart';
import 'package:outlet/appstream.dart/lib/src/url.dart';
import 'package:outlet/core/application.dart';
@@ -5,8 +6,18 @@ import 'package:outlet/views/components/theme.dart';
import 'package:url_launcher/url_launcher.dart';
Future<void> _launchURL(String url) async {
+ if (Platform.isLinux) {
+ final result = await Process.run(
+ 'gio',
+ ['open', url],
+ environment: {'GIO_USE_PORTAL': '1'},
+ );
+
+ if (result.exitCode == 0) return;
+ }
+
if (await canLaunchUrl(Uri.parse(url))) {
- await launchUrl(Uri.parse(url));
+ await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
} else {
throw 'Could not launch $url';
}