TF-903: Open to other app using deeplink

This commit is contained in:
ManhNTX
2022-09-12 06:38:04 +07:00
committed by Dat H. Pham
parent 82845e0fd1
commit 2154195a66
4 changed files with 17 additions and 3 deletions
+8
View File
@@ -21,6 +21,14 @@
<category android:name="android.intent.category.APP_BROWSER" /> <category android:name="android.intent.category.APP_BROWSER" />
<data android:scheme="https" /> <data android:scheme="https" />
</intent> </intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="sms" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent>
</queries> </queries>
<application <application
@@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart' as launcher; import 'package:url_launcher/url_launcher.dart' as launcher;
import 'package:url_launcher/url_launcher_string.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
import 'dart:developer' as developer; import 'dart:developer' as developer;
@@ -151,8 +152,11 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
await urlDelegate(Uri.parse(url)); await urlDelegate(Uri.parse(url));
return NavigationDecision.prevent; return NavigationDecision.prevent;
} }
if (await launcher.canLaunch(url)) { if (await launcher.canLaunchUrl(Uri.parse(url))) {
await launcher.launch(url); await launcher.launchUrl(
Uri.parse(url),
mode: LaunchMode.externalApplication
);
} }
return NavigationDecision.prevent; return NavigationDecision.prevent;
} }
+1 -1
View File
@@ -62,7 +62,7 @@ dependencies:
webview_flutter: 3.0.0 webview_flutter: 3.0.0
# url_launcher # url_launcher
url_launcher: 6.0.17 url_launcher: 6.1.5
# collection # collection
collection: 1.16.0 collection: 1.16.0
+2
View File
@@ -46,6 +46,8 @@
<string>https</string> <string>https</string>
<string>http</string> <string>http</string>
<string>mailto</string> <string>mailto</string>
<string>sms</string>
<string>tel</string>
</array> </array>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>