Matthias Nott
9 days ago d420bfc4b7c1699b7df8a1eb6d295b1835a26108
fix: markdown links open in browser/app instead of copying to clipboard
5 files modified
changed files
ios/Podfile.lock patch | view | blame | history
lib/widgets/message_bubble.dart patch | view | blame | history
macos/Flutter/GeneratedPluginRegistrant.swift patch | view | blame | history
pubspec.lock patch | view | blame | history
pubspec.yaml patch | view | blame | history
ios/Podfile.lock
....@@ -69,6 +69,8 @@
6969 - Flutter
7070 - FlutterMacOS
7171 - SwiftyGif (5.4.5)
72
+ - url_launcher_ios (0.0.1):
73
+ - Flutter
7274 - vibration (1.7.5):
7375 - Flutter
7476
....@@ -88,6 +90,7 @@
8890 - record_ios (from `.symlinks/plugins/record_ios/ios`)
8991 - share_plus (from `.symlinks/plugins/share_plus/ios`)
9092 - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
93
+ - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
9194 - vibration (from `.symlinks/plugins/vibration/ios`)
9295
9396 SPEC REPOS:
....@@ -128,6 +131,8 @@
128131 :path: ".symlinks/plugins/share_plus/ios"
129132 shared_preferences_foundation:
130133 :path: ".symlinks/plugins/shared_preferences_foundation/darwin"
134
+ url_launcher_ios:
135
+ :path: ".symlinks/plugins/url_launcher_ios/ios"
131136 vibration:
132137 :path: ".symlinks/plugins/vibration/ios"
133138
....@@ -151,6 +156,7 @@
151156 share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
152157 shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
153158 SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
159
+ url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
154160 vibration: 8e2f50fc35bb736f9eecb7dd9f7047fbb6a6e888
155161
156162 PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e
lib/widgets/message_bubble.dart
....@@ -5,6 +5,7 @@
55 import 'package:flutter/material.dart';
66 import 'package:flutter/services.dart';
77 import 'package:flutter_markdown/flutter_markdown.dart';
8
+import 'package:url_launcher/url_launcher.dart';
89 import 'package:intl/intl.dart';
910
1011 import '../models/message.dart';
....@@ -165,13 +166,10 @@
165166 ),
166167 onTapLink: (text, href, title) {
167168 if (href != null) {
168
- Clipboard.setData(ClipboardData(text: href));
169
- ScaffoldMessenger.of(context).showSnackBar(
170
- SnackBar(
171
- content: Text('Link copied: $href'),
172
- duration: const Duration(seconds: 2),
173
- ),
174
- );
169
+ final uri = Uri.tryParse(href);
170
+ if (uri != null) {
171
+ launchUrl(uri, mode: LaunchMode.externalApplication);
172
+ }
175173 }
176174 },
177175 );
macos/Flutter/GeneratedPluginRegistrant.swift
....@@ -18,6 +18,7 @@
1818 import record_macos
1919 import share_plus
2020 import shared_preferences_foundation
21
+import url_launcher_macos
2122
2223 func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
2324 AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
....@@ -33,4 +34,5 @@
3334 RecordMacOsPlugin.register(with: registry.registrar(forPlugin: "RecordMacOsPlugin"))
3435 SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
3536 SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
37
+ UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
3638 }
pubspec.lock
....@@ -1061,6 +1061,30 @@
10611061 url: "https://pub.dev"
10621062 source: hosted
10631063 version: "5.0.3"
1064
+ url_launcher:
1065
+ dependency: "direct main"
1066
+ description:
1067
+ name: url_launcher
1068
+ sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
1069
+ url: "https://pub.dev"
1070
+ source: hosted
1071
+ version: "6.3.2"
1072
+ url_launcher_android:
1073
+ dependency: transitive
1074
+ description:
1075
+ name: url_launcher_android
1076
+ sha256: "3bb000251e55d4a209aa0e2e563309dc9bb2befea2295fd0cec1f51760aac572"
1077
+ url: "https://pub.dev"
1078
+ source: hosted
1079
+ version: "6.3.29"
1080
+ url_launcher_ios:
1081
+ dependency: transitive
1082
+ description:
1083
+ name: url_launcher_ios
1084
+ sha256: "580fe5dfb51671ae38191d316e027f6b76272b026370708c2d898799750a02b0"
1085
+ url: "https://pub.dev"
1086
+ source: hosted
1087
+ version: "6.4.1"
10641088 url_launcher_linux:
10651089 dependency: transitive
10661090 description:
....@@ -1069,6 +1093,14 @@
10691093 url: "https://pub.dev"
10701094 source: hosted
10711095 version: "3.2.2"
1096
+ url_launcher_macos:
1097
+ dependency: transitive
1098
+ description:
1099
+ name: url_launcher_macos
1100
+ sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18"
1101
+ url: "https://pub.dev"
1102
+ source: hosted
1103
+ version: "3.2.5"
10721104 url_launcher_platform_interface:
10731105 dependency: transitive
10741106 description:
pubspec.yaml
....@@ -35,6 +35,7 @@
3535 flutter_app_badger: ^1.5.0
3636 connectivity_plus: ^7.1.0
3737 in_app_purchase: ^3.2.3
38
+ url_launcher: ^6.3.2
3839
3940 dev_dependencies:
4041 flutter_test: