diff --git a/i18n/en-US.json b/i18n/en-US.json index 2bca025..4dbf198 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -1223,5 +1223,6 @@ "man_retranslate":"人工重译", "robot_retranslate":"机器重译", "see_original":"查看原文", - "forward":"Forward" + "forward":"Forward", + "copy_download_url":"复制下载地址" } \ No newline at end of file diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json index 32d88b8..526cffc 100644 --- a/i18n/ja-JP.json +++ b/i18n/ja-JP.json @@ -1223,5 +1223,6 @@ "man_retranslate":"人工重译", "robot_retranslate":"机器重译", "see_original":"查看原文", - "forward":"转发" + "forward":"转发", + "copy_download_url":"复制下载地址" } \ No newline at end of file diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json index cd55d56..b44caeb 100644 --- a/i18n/ko-KR.json +++ b/i18n/ko-KR.json @@ -1223,5 +1223,6 @@ "man_retranslate":"人工重译", "robot_retranslate":"机器重译", "see_original":"查看原文", - "forward":"转发" + "forward":"转发", + "copy_download_url":"复制下载地址" } \ No newline at end of file diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json index 7508d4a..e789546 100644 --- a/i18n/vi-VN.json +++ b/i18n/vi-VN.json @@ -1223,5 +1223,6 @@ "man_retranslate":"人工重译", "robot_retranslate":"机器重译", "see_original":"查看原文", - "forward":"转发" + "forward":"转发", + "copy_download_url":"复制下载地址" } \ No newline at end of file diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json index dbcf39d..af64e22 100644 --- a/i18n/zh-CN.json +++ b/i18n/zh-CN.json @@ -1223,5 +1223,6 @@ "man_retranslate":"人工重译", "robot_retranslate":"机器重译", "see_original":"查看原文", - "forward":"转发" + "forward":"转发", + "copy_download_url":"复制下载地址" } \ No newline at end of file diff --git a/i18n/zh-HK.json b/i18n/zh-HK.json index 798b7f6..bd48da2 100644 --- a/i18n/zh-HK.json +++ b/i18n/zh-HK.json @@ -1223,5 +1223,6 @@ "man_retranslate":"人工重譯", "robot_retranslate":"機器重譯", "see_original":"查看原文", - "forward":"转发" + "forward":"转发", + "copy_download_url":"複製下載地址" } \ No newline at end of file diff --git a/lib/chat/group_chat_item.dart b/lib/chat/group_chat_item.dart index e5a1c46..f7c132b 100644 --- a/lib/chat/group_chat_item.dart +++ b/lib/chat/group_chat_item.dart @@ -572,11 +572,12 @@ class _GroupChatPageItemState extends State Widget wrapItemWithMenu(item) { List actionsFunc = []; - List actions = [I18n.of(context).delete, I18n.of(context).reply,I18n.of(context).forward]; + List actions = [ + I18n.of(context).reply, + I18n.of(context).forward, + I18n.of(context).delete, + ]; - actionsFunc.add(() { - MessageMgr().emit('Delete Select Message', widget.msg); - }); actionsFunc.add(() { print('发送引用的消息'); MessageMgr().emit('Reply Select Message', widget.msg); @@ -585,6 +586,9 @@ class _GroupChatPageItemState extends State print('转发消息'); AppNavigator.pushForwardPage(context, widget.msg); }); + actionsFunc.add(() { + MessageMgr().emit('Delete Select Message', widget.msg); + }); @@ -621,6 +625,15 @@ class _GroupChatPageItemState extends State Clipboard.setData(clipboardData); }); } + + //如果是文件增加复制下载地址 + if (widget.msg.msgType == ChatType.FileChatType.value) { + actions.insert(0, I18n.of(context).copy_download_url); + actionsFunc.insert(0, () { + UploadUtil().copyFileUrl(widget.msg, context); + }); + } + if (widget.msg.msgType == ChatType.ShortVoiceChatType.value) { var soundPlayMode = Provider.of(context).soundPlayMode; @@ -1365,8 +1378,9 @@ class _GroupChatPageItemState extends State onTap: () { AppNavigator.pushProfileInfoPage(context, memberModel.memberId, fromWhere: 2, - addMode: - !FriendListMgr().isMyFriend(memberModel.memberId) ? 1 : 0); + addMode: !FriendListMgr().isMyFriend(memberModel.memberId) + ? 1 + : 0); }, onLongPress: () { print('long press user'); diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index c69a47a..5546728 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -2483,6 +2483,8 @@ class I18n implements WidgetsLocalizations { String get see_original => "查看原文"; /// "Forward" String get forward => "Forward"; + /// "复制下载地址" + String get copy_download_url => "复制下载地址"; } class _I18n_en_US extends I18n { @@ -6170,6 +6172,9 @@ class _I18n_vi_VN extends I18n { /// "转发" @override String get forward => "转发"; + /// "复制下载地址" + @override + String get copy_download_url => "复制下载地址"; @override TextDirection get textDirection => TextDirection.ltr; @@ -9853,6 +9858,9 @@ class _I18n_zh_HK extends I18n { /// "转发" @override String get forward => "转发"; + /// "複製下載地址" + @override + String get copy_download_url => "複製下載地址"; @override TextDirection get textDirection => TextDirection.ltr; @@ -13536,6 +13544,9 @@ class _I18n_zh_CN extends _I18n_zh_HK { /// "转发" @override String get forward => "转发"; + /// "复制下载地址" + @override + String get copy_download_url => "复制下载地址"; @override TextDirection get textDirection => TextDirection.ltr; @@ -17219,6 +17230,9 @@ class _I18n_ko_KR extends I18n { /// "转发" @override String get forward => "转发"; + /// "复制下载地址" + @override + String get copy_download_url => "复制下载地址"; @override TextDirection get textDirection => TextDirection.ltr; @@ -20902,6 +20916,9 @@ class _I18n_ja_JP extends I18n { /// "转发" @override String get forward => "转发"; + /// "复制下载地址" + @override + String get copy_download_url => "复制下载地址"; @override TextDirection get textDirection => TextDirection.ltr; diff --git a/lib/utils/upload_util.dart b/lib/utils/upload_util.dart index fb0ffde..3580f9c 100644 --- a/lib/utils/upload_util.dart +++ b/lib/utils/upload_util.dart @@ -10,6 +10,8 @@ import 'package:chat/utils/file_cache_mgr.dart'; import 'package:convert/convert.dart'; import 'package:dio/dio.dart'; import 'package:crypto/crypto.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'dart:async'; import 'package:http_parser/http_parser.dart'; import 'package:chat/utils/MessageMgr.dart'; @@ -187,6 +189,13 @@ class UploadUtil { 'downloadchatfile?targetid=$sessionid&channeltype=$channelType&userid=${UserData().basicInfo.userId}&fileid=$imgData&sign=$sign'; } + copyFileUrl(MsgModel msg, BuildContext context) { + var url = getFullUrl(msg.extraFile, msg.sessionId, msg.channelType); + ClipboardData clipboardData = new ClipboardData(text: url); + Clipboard.setData(clipboardData); + showToast(I18n.of(context).successful_copy); + } + Future downloadFile(MsgModel msg, {CancelToken cancelToken}) async { Response response;