@@ -1223,5 +1223,6 @@ | |||
"man_retranslate":"人工重译", | |||
"robot_retranslate":"机器重译", | |||
"see_original":"查看原文", | |||
"forward":"Forward" | |||
"forward":"Forward", | |||
"copy_download_url":"复制下载地址" | |||
} |
@@ -1223,5 +1223,6 @@ | |||
"man_retranslate":"人工重译", | |||
"robot_retranslate":"机器重译", | |||
"see_original":"查看原文", | |||
"forward":"转发" | |||
"forward":"转发", | |||
"copy_download_url":"复制下载地址" | |||
} |
@@ -1223,5 +1223,6 @@ | |||
"man_retranslate":"人工重译", | |||
"robot_retranslate":"机器重译", | |||
"see_original":"查看原文", | |||
"forward":"转发" | |||
"forward":"转发", | |||
"copy_download_url":"复制下载地址" | |||
} |
@@ -1223,5 +1223,6 @@ | |||
"man_retranslate":"人工重译", | |||
"robot_retranslate":"机器重译", | |||
"see_original":"查看原文", | |||
"forward":"转发" | |||
"forward":"转发", | |||
"copy_download_url":"复制下载地址" | |||
} |
@@ -1223,5 +1223,6 @@ | |||
"man_retranslate":"人工重译", | |||
"robot_retranslate":"机器重译", | |||
"see_original":"查看原文", | |||
"forward":"转发" | |||
"forward":"转发", | |||
"copy_download_url":"复制下载地址" | |||
} |
@@ -1223,5 +1223,6 @@ | |||
"man_retranslate":"人工重譯", | |||
"robot_retranslate":"機器重譯", | |||
"see_original":"查看原文", | |||
"forward":"转发" | |||
"forward":"转发", | |||
"copy_download_url":"複製下載地址" | |||
} |
@@ -253,8 +253,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
} else { | |||
///todo 翻译管家系统通知消息 | |||
if (type == ChatType.GroupChatNoticeType.value) { | |||
var res = GroupChatNotice.fromBuffer(widget.msg.msgContent); | |||
@@ -621,21 +619,21 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
Widget wrapItemWithMenu(item) { | |||
List<Function> actionsFunc = []; | |||
List<String> actions = [ | |||
I18n.of(context).delete, | |||
I18n.of(context).forward, | |||
I18n.of(context).reply, | |||
I18n.of(context).forward | |||
I18n.of(context).delete, | |||
]; | |||
actionsFunc.add(() { | |||
MessageMgr().emit('Delete Select Message', widget.msg); | |||
print('转发消息'); | |||
AppNavigator.pushForwardPage(context, widget.msg); | |||
}); | |||
actionsFunc.add(() { | |||
print('发送引用的消息'); | |||
MessageMgr().emit('Reply Select Message', widget.msg); | |||
}); | |||
actionsFunc.add(() { | |||
print('转发消息'); | |||
AppNavigator.pushForwardPage(context, widget.msg); | |||
MessageMgr().emit('Delete Select Message', widget.msg); | |||
}); | |||
if (widget.msg.msgType == ChatType.TextChatType.value) { | |||
@@ -649,6 +647,14 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
}); | |||
} | |||
//如果是文件增加复制下载地址 | |||
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<KeyboardIndexProvider>(context).soundPlayMode; | |||
@@ -663,7 +669,7 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
}); | |||
} | |||
// String date2 = DateTime.fromMillisecondsSinceEpoch(widget.msg.time).toString(); | |||
return WPopupMenu( | |||
return WPopupMenu( | |||
child: item, | |||
actions: actions, | |||
onLongPressStart: () { | |||
@@ -830,14 +836,17 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
if (transTag == 1) { | |||
//机器翻译中 | |||
userTranslateWidget = _translateItemWidget(0xe670, I18n.of(context).man_retranslate, null); | |||
userTranslateWidget = | |||
_translateItemWidget(0xe670, I18n.of(context).man_retranslate, null); | |||
machineTranslateWidget = | |||
_translateItemWidget(0xe671, I18n.of(context).robotTranslate, null); | |||
} else if (transTag == 2) { | |||
//人工翻译中 | |||
userTranslateWidget = _translateItemWidget(0xe670, I18n.of(context).ManTranslate, null); | |||
machineTranslateWidget = _translateItemWidget(0xe671, I18n.of(context).robot_retranslate, () { | |||
userTranslateWidget = | |||
_translateItemWidget(0xe670, I18n.of(context).ManTranslate, null); | |||
machineTranslateWidget = | |||
_translateItemWidget(0xe671, I18n.of(context).robot_retranslate, () { | |||
setState(() { | |||
curTextType += 1; | |||
curTextType %= textList.length; | |||
@@ -889,7 +898,8 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
}); | |||
} | |||
}); | |||
machineTranslateWidget = _translateItemWidget(0xe671, I18n.of(context).robot_retranslate, () { | |||
machineTranslateWidget = | |||
_translateItemWidget(0xe671, I18n.of(context).robot_retranslate, () { | |||
setState(() { | |||
curTextType += 1; | |||
curTextType %= textList.length; | |||
@@ -944,7 +954,8 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
)) | |||
], | |||
))); | |||
machineTranslateWidget = _translateItemWidget(0xe675, I18n.of(context).see_original, () { | |||
machineTranslateWidget = | |||
_translateItemWidget(0xe675, I18n.of(context).see_original, () { | |||
setState(() { | |||
curTextType = textList.length - 1; | |||
}); | |||
@@ -563,11 +563,12 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||
Widget wrapItemWithMenu(item) { | |||
List<Function> actionsFunc = []; | |||
List<String> actions = [I18n.of(context).delete, I18n.of(context).reply,I18n.of(context).forward]; | |||
List<String> 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); | |||
@@ -576,6 +577,9 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||
print('转发消息'); | |||
AppNavigator.pushForwardPage(context, widget.msg); | |||
}); | |||
actionsFunc.add(() { | |||
MessageMgr().emit('Delete Select Message', widget.msg); | |||
}); | |||
if (widget.msg.msgType == ChatType.TextChatType.value) { | |||
actions.insert(0, I18n.of(context).copy); | |||
@@ -587,6 +591,15 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||
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<KeyboardIndexProvider>(context).soundPlayMode; | |||
@@ -1308,8 +1321,9 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||
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'); | |||
@@ -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; | |||
@@ -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; | |||