@@ -56,9 +56,9 @@ android { | |||
// manifestPlaceholders = [ | |||
// AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key | |||
// ] | |||
ndk { | |||
abiFilters 'armeabi-v7a' | |||
} | |||
// ndk { | |||
// abiFilters 'armeabi-v7a' | |||
// } | |||
multiDexEnabled true | |||
manifestPlaceholders = [ | |||
JPUSH_PKGNAME : 'com.cyhd.henhoandroid', | |||
@@ -433,10 +433,7 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
quoteItem['showTimeStr'], quoteItem['quoteContent'], true)); | |||
} | |||
var contentWidth = _getTextWidth(textList[curTextType]); | |||
if (contentWidth > width && contentWidth <= maxWidth) { | |||
width = contentWidth; | |||
} | |||
width = min(max(contentWidth, width), maxWidth); | |||
showMsg.add(Container( | |||
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22), | |||
alignment: Alignment.centerLeft, | |||
@@ -926,9 +923,7 @@ class _ChatPageItemState extends State<ChatPageItem> | |||
} | |||
var contentWidth = _getTextWidth(textList[curTextType]); | |||
if (contentWidth > width && contentWidth <= maxWidth) { | |||
width = contentWidth; | |||
} | |||
width = min(max(contentWidth, width), maxWidth); | |||
showMsg.add(Container( | |||
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22), | |||
@@ -397,9 +397,7 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||
quoteItem['showTimeStr'], quoteItem['quoteContent'], true)); | |||
} | |||
var contentWidth = _getTextWidth(textList[curTextType]); | |||
if (contentWidth > width && contentWidth <= maxWidth) { | |||
width = contentWidth; | |||
} | |||
width = min(max(contentWidth, width), maxWidth); | |||
showMsg.add(Container( | |||
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22), | |||
@@ -896,9 +894,7 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||
} | |||
var contentWidth = _getTextWidth(textList[curTextType]); | |||
if (contentWidth > width && contentWidth <= maxWidth) { | |||
width = contentWidth; | |||
} | |||
width = min(max(contentWidth, width), maxWidth); | |||
showMsg.add(Container( | |||
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22), | |||
@@ -80,26 +80,26 @@ class InputBarState extends State<InputBar> | |||
getKeyboardHeight(); | |||
_bloc.start(); | |||
_textCtrl.addListener(() { | |||
if (alterPosition.length > 0) { | |||
int offset = -1; | |||
int currentIndex = _textCtrl.selection.baseOffset; | |||
for (int i = 0; i < alterPosition.length; i++) { | |||
var postion = alterPosition[i]; | |||
if (currentIndex >= postion.startIndex && | |||
currentIndex <= postion.endIndex) { | |||
int middle = (postion.startIndex + postion.endIndex) ~/ 2; | |||
offset = | |||
currentIndex >= middle ? postion.endIndex : postion.startIndex; | |||
break; | |||
} | |||
} | |||
if (offset != -1) { | |||
_textCtrl.value = TextEditingValue( | |||
text: _textCtrl.text, | |||
selection: | |||
TextSelection.fromPosition(TextPosition(offset: offset))); | |||
} | |||
} | |||
// if (alterPosition.length > 0) { | |||
// int offset = -1; | |||
// int currentIndex = _textCtrl.selection.baseOffset; | |||
// for (int i = 0; i < alterPosition.length; i++) { | |||
// var postion = alterPosition[i]; | |||
// if (currentIndex >= postion.startIndex && | |||
// currentIndex <= postion.endIndex) { | |||
// int middle = (postion.startIndex + postion.endIndex) ~/ 2; | |||
// offset = | |||
// currentIndex >= middle ? postion.endIndex : postion.startIndex; | |||
// break; | |||
// } | |||
// } | |||
// if (offset != -1) { | |||
// _textCtrl.value = TextEditingValue( | |||
// text: _textCtrl.text, | |||
// selection: | |||
// TextSelection.fromPosition(TextPosition(offset: offset))); | |||
// } | |||
// } | |||
}); | |||
//处理引用事件 | |||
MessageMgr().on('Reply Select Message', replySelectMsg); | |||
@@ -195,9 +195,8 @@ class InputBarState extends State<InputBar> | |||
for (int i = 0; i < alterPosition.length; i++) { | |||
var postion = alterPosition[i]; | |||
if (currentIndex >= postion.startIndex && | |||
currentIndex <= postion.endIndex) { | |||
result = originalInputStr.replaceRange( | |||
postion.startIndex, postion.endIndex, ''); | |||
currentIndex < postion.endIndex) { | |||
result = originalInputStr.replaceRange(postion.startIndex, postion.endIndex, ''); | |||
starIndex = postion.startIndex; | |||
alterPosition.removeAt(i); | |||
break; | |||
@@ -248,6 +248,7 @@ class UserData { | |||
Vibration.vibrate(); | |||
Timer.periodic(Duration(seconds: 3), (timer) async { | |||
UserData().isShocking = false; | |||
timer.cancel(); | |||
}); | |||
} | |||
} | |||
@@ -712,43 +712,48 @@ class _AddProgramState extends State<AddProgram> { | |||
List<Asset> resultList = List<Asset>(); | |||
resultList = await MultiImagePicker.pickImages( | |||
maxImages: Max_Img_Num - imgUrlList.length, | |||
enableCamera: false, | |||
selectedAssets: [], | |||
cupertinoOptions: CupertinoOptions(takePhotoIcon: "chat"), | |||
materialOptions: MaterialOptions( | |||
actionBarColor: "#50A7F9", | |||
actionBarTitle: "Hibok", | |||
allViewTitle: "", | |||
useDetailsView: false, | |||
selectCircleStrokeColor: "#000000", | |||
), | |||
); | |||
if (resultList != null && resultList.length > 0) { | |||
List<File> fileList = []; | |||
for (var i = 0; i < resultList.length; i++) { | |||
Asset photoEntity = resultList[i]; | |||
print('名字:${photoEntity.name}'); | |||
ByteData byteData = await photoEntity.getByteData(); | |||
File file = await FileCacheMgr().writeFile('temp-photo-${DateTime.now().millisecondsSinceEpoch}.png', byteData.buffer.asInt8List(0)); | |||
resultList = await MultiImagePicker.pickImages( | |||
maxImages: Max_Img_Num - imgUrlList.length, | |||
enableCamera: false, | |||
selectedAssets: [], | |||
cupertinoOptions: CupertinoOptions(takePhotoIcon: "chat"), | |||
materialOptions: MaterialOptions( | |||
actionBarColor: "#50A7F9", | |||
actionBarTitle: "Hibok", | |||
allViewTitle: "", | |||
useDetailsView: false, | |||
selectCircleStrokeColor: "#000000", | |||
), | |||
); | |||
fileList.add(file); | |||
} | |||
print('文件列表${fileList.length}'); | |||
Map data = {"type": 3, "userId": UserData().basicInfo.userId}; | |||
if (resultList != null && resultList.length > 0) { | |||
List<File> fileList = []; | |||
for (var i = 0; i < resultList.length; i++) { | |||
Asset photoEntity = resultList[i]; | |||
print('名字:${photoEntity.name}'); | |||
ByteData byteData = await photoEntity.getByteData(); | |||
File file = await FileCacheMgr().writeFile( | |||
'temp-photo-${DateTime.now().millisecondsSinceEpoch}.png', | |||
byteData.buffer.asInt8List(0)); | |||
fileList.add(file); | |||
} | |||
print('文件列表${fileList.length}'); | |||
Map data = {"type": 7, "userId": UserData().basicInfo.userId}; | |||
data['sign'] = TokenMgr().getSign(data); | |||
Response res = await HttpUtil().uploadFiles( | |||
fileList, data, 'upload/post/postfiles', 'image', | |||
isShowLoading: true); | |||
var resData = res.data; | |||
if (resData['code'] == 0 && resData['msg'] != null) { | |||
imgUrlList.addAll(resData['msg'].split("|")); | |||
setState(() {}); | |||
var resData = res.data; | |||
if (resData['code'] == 0 && resData['msg'] != null) { | |||
var returnList = resData['msg'].split('|'); | |||
imgUrlList.addAll(returnList); | |||
if (returnList.length != fileList.length) { | |||
showToast(I18n.of(context).hava_error_photo); | |||
} | |||
setState(() {}); | |||
} | |||
} | |||
// var photos = await PhotoPicker.pickAsset( | |||
// context: context, | |||
@@ -908,8 +913,7 @@ class _AddProgramState extends State<AddProgram> { | |||
contentPadding: | |||
EdgeInsets.only(top: 6, bottom: 10, right: 10), | |||
hintText: I18n.of(context).please_civilization, | |||
hintStyle: | |||
TextStyle(fontSize: 12, height: 1.15), | |||
hintStyle: TextStyle(fontSize: 12, height: 1.15), | |||
border: InputBorder.none, | |||
), | |||
style: TextStyle( | |||
@@ -1198,7 +1202,7 @@ class _AddProgramState extends State<AddProgram> { | |||
.replaceFirst('/s1', UserData().addProgramPrice.toString()); | |||
} | |||
return Container( | |||
padding: EdgeInsets.only(bottom: 100, left: 20, right: 20), | |||
padding: EdgeInsets.only(bottom: 100, left: 20, right: 20), | |||
child: Text( | |||
str, | |||
textScaleFactor: 1.0, | |||
@@ -1352,8 +1356,8 @@ class _AddProgramState extends State<AddProgram> { | |||
var hopeObject = ''; | |||
lovePeopleId.forEach((f) => hopeObject += hopeObject == '' ? f : ',$f'); | |||
String temp=''; | |||
String postTemp=''; | |||
String temp = ''; | |||
String postTemp = ''; | |||
imgUrlList.forEach((str) { | |||
temp += (temp == "" ? str : '|$str'); | |||
postTemp += (postTemp == "" | |||
@@ -179,7 +179,6 @@ class _InformUserPageState extends State<InformUserPage> { | |||
} | |||
void _sendPicture() async { | |||
List<Asset> resultList = List<Asset>(); | |||
resultList = await MultiImagePicker.pickImages( | |||
@@ -201,7 +200,9 @@ class _InformUserPageState extends State<InformUserPage> { | |||
for (var i = 0; i < resultList.length; i++) { | |||
Asset photoEntity = resultList[i]; | |||
ByteData byteData = await photoEntity.getByteData(); | |||
File file = await FileCacheMgr().writeFile('temp-photo-${DateTime.now().millisecondsSinceEpoch}.png', byteData.buffer.asInt8List(0)); | |||
File file = await FileCacheMgr().writeFile( | |||
'temp-photo-${DateTime.now().millisecondsSinceEpoch}.png', | |||
byteData.buffer.asInt8List(0)); | |||
fileList.add(file); | |||
} | |||
Map data = {"type": 3, "userId": UserData().basicInfo.userId}; | |||
@@ -211,13 +212,15 @@ class _InformUserPageState extends State<InformUserPage> { | |||
isShowLoading: true); | |||
var resData = res.data; | |||
if (resData['code'] == 0 && resData['msg'] != null) { | |||
imgUrlList.addAll(resData['msg'].split("|")); | |||
var returnList = resData['msg'].split('|'); | |||
imgUrlList.addAll(returnList); | |||
if (returnList.length != fileList.length) { | |||
showToast(I18n.of(context).hava_error_photo); | |||
} | |||
setState(() {}); | |||
} | |||
} | |||
// var photos = await PhotoPicker.pickAsset( | |||
// context: context, | |||
// themeColor: Color(0xFFF0F0F0), | |||
@@ -2,6 +2,7 @@ import 'package:chat/data/UserData.dart'; | |||
import 'package:chat/data/WebData.dart'; | |||
import 'package:chat/data/constants.dart'; | |||
import 'package:chat/generated/i18n.dart'; | |||
import 'package:chat/models/ref_name_provider.dart'; | |||
import 'package:chat/utils/CustomUI.dart'; | |||
import 'package:chat/utils/HttpUtil.dart'; | |||
import 'package:chat/utils/MessageMgr.dart'; | |||
@@ -11,6 +12,7 @@ import 'package:dio/dio.dart'; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter/services.dart'; | |||
import 'package:provider/provider.dart'; | |||
import 'ProfilePage.dart'; | |||
@@ -258,8 +260,9 @@ class _NewFriendsPageState extends State<NewFriendsPage> { | |||
return _ContactItem( | |||
userId: _contact.friendId, | |||
avatar: _contact.avatar, | |||
title: _contact.name, | |||
state: _contact.state, | |||
title: Provider.of<RefNameProvider>(context) | |||
.getRefName(_contact.friendId, _contact.name), | |||
state: _contact.state, | |||
isShowDivder: true, | |||
applyId: _contact.applyId, | |||
groupTitle: _isGroupTitle | |||
@@ -44,9 +44,9 @@ class HttpUtil { | |||
//static const String BaseUrl = 'http://192.168.0.223:7001/'; | |||
//static const String BaseUrl = 'http://192.168.0.207:9080/'; | |||
// static const String BaseUrl = 'http://120.79.107.63:9080/'; | |||
static const String BaseUrl = 'http://120.79.107.63:9080/'; | |||
//static const String BaseUrl = 'http://192.168.0.177:9016/'; | |||
static const String BaseUrl = 'https://datasm.chengyouhd.com/'; | |||
//static const String BaseUrl = 'https://datasm.chengyouhd.com/'; | |||
static HttpUtil _getInstance() { | |||
if (_instance == null) { | |||
@@ -1409,19 +1409,17 @@ class HttpUtil { | |||
}; | |||
data['sign'] = TokenMgr().getSign(data); | |||
Response res = await HttpUtil() | |||
.post('friendship/check/userFriends', data: data); | |||
Response res = | |||
await HttpUtil().post('friendship/check/userFriends', data: data); | |||
Map resData = res.data; | |||
if (resData['code'] == 0) { | |||
FriendListMgr().checkFromServer(resData['data']); | |||
} | |||
} | |||
//保存设备名称和编码 | |||
saveMobileInfo() async { | |||
String mobileType = ''; | |||
saveMobileInfo() async { | |||
String mobileType = ''; | |||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); | |||
if (Platform.isAndroid) { | |||
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; | |||
@@ -1447,11 +1445,12 @@ String mobileType = ''; | |||
} | |||
///实时帮-翻译管家评价 | |||
evaluationTransalteHK(String orderNo,String value,bool isGood,Function callback) async { | |||
evaluationTransalteHK( | |||
String orderNo, String value, bool isGood, Function callback) async { | |||
Map data = { | |||
"userId": UserData().basicInfo.userId, | |||
"orderNo": orderNo, | |||
"gradeStatus":isGood?1:2 | |||
"gradeStatus": isGood ? 1 : 2 | |||
}; | |||
data['sign'] = TokenMgr().getSign(data); | |||
data['value'] = value; | |||
@@ -1464,14 +1463,13 @@ String mobileType = ''; | |||
var resData = res.data; | |||
if (resData['code'] == 0) { | |||
showToast('评价成功'); | |||
}else{ | |||
} else { | |||
showToast(I18n.of(Constants.getCurrentContext()).net_error); | |||
} | |||
} | |||
///实时帮-用户测距 | |||
userRanging(int distance,String origin,String ending) async { | |||
userRanging(int distance, String origin, String ending) async { | |||
Map data = { | |||
"userId": UserData().basicInfo.userId, | |||
"distance": distance, | |||
@@ -1488,17 +1486,16 @@ String mobileType = ''; | |||
var resData = res.data; | |||
if (resData['code'] == 0) { | |||
print('实时帮-用户测距提交 成功'); | |||
}else{ | |||
} else { | |||
print('实时帮-用户测距提交 失败'); | |||
} | |||
} | |||
///实时帮-翻译人员上线、下线 | |||
translateHKloginRecord(bool isLogin,Function callback) async { | |||
translateHKloginRecord(bool isLogin, Function callback) async { | |||
Map data = { | |||
"userId": UserData().basicInfo.userId, | |||
"type": isLogin?1:2, | |||
"type": isLogin ? 1 : 2, | |||
}; | |||
data['sign'] = TokenMgr().getSign(data); | |||
print('请求data : $data'); | |||
@@ -1512,12 +1509,8 @@ String mobileType = ''; | |||
if (resData['code'] == 0) { | |||
callback(); | |||
print('翻译人员上线、下线 成功'); | |||
}else{ | |||
} else { | |||
print('翻译人员上线、下线 失败 ${resData['msg']}'); | |||
} | |||
} | |||
} |
@@ -124,12 +124,12 @@ class MsgHandler { | |||
static createSendMsg(ChatType chatType, content, | |||
{int extra, | |||
int friendId, | |||
String localFile, | |||
MsgModel refMsg, | |||
String refShortTxt, | |||
List<int> altUsers, | |||
ChatChannelType channelType = ChatChannelType.Session}) { | |||
int friendId, | |||
String localFile, | |||
MsgModel refMsg, | |||
String refShortTxt, | |||
List<int> altUsers, | |||
ChatChannelType channelType = ChatChannelType.Session}) { | |||
MsgModel msg; | |||
if (content is String) { | |||
@@ -247,7 +247,7 @@ class MsgHandler { | |||
seq.channelType = ChatChannelType.CSD; | |||
} else { | |||
seq.channelType = | |||
isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||
isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||
} | |||
NetWork().sendMsg(ComId.Chat, 5, seq); | |||
@@ -257,7 +257,6 @@ class MsgHandler { | |||
static int mLastClickTime = 0; | |||
static int timeInterval = 2500; | |||
static handlerReceiveMsg(PushChat chat) async { | |||
bool isGroup = false; | |||
bool isTranslateHK = false; | |||
if (chat.channelType == ChatChannelType.Group) { | |||
@@ -318,7 +317,7 @@ class MsgHandler { | |||
} | |||
MessageMgr().emit('Update Translate Message', findMsg); | |||
}else{ | |||
} else { | |||
debugPrint2('更新消息找不到!!!!!!'); | |||
} | |||
} else { | |||
@@ -417,41 +416,40 @@ class MsgHandler { | |||
} | |||
} else if (isTranslateHK) { | |||
var myId = UserData().basicInfo.userId; | |||
TransHKChatNotice notice = TransHKChatNotice.fromBuffer(chat.contentBuff); | |||
BaseUserInfo friendId ; | |||
TranslateHKMgr().isUser = myId== notice.employer.id; ///判断自己是翻译官还是用户 | |||
TransHKChatNotice notice = | |||
TransHKChatNotice.fromBuffer(chat.contentBuff); | |||
BaseUserInfo friendId; | |||
TranslateHKMgr().isUser = myId == notice.employer.id; | |||
///判断自己是翻译官还是用户 | |||
if(myId== notice.employer.id){ | |||
friendId =notice.inter; | |||
}else{ | |||
if (myId == notice.employer.id) { | |||
friendId = notice.inter; | |||
} else { | |||
friendId = notice.employer; | |||
} | |||
print('friend id: ${friendId.id} '); | |||
print('结束chat.sendTime ${chat.sendTime}'); | |||
int sessionId = chat.targetId; | |||
if (chat.cType == ChatType.GroupChatNoticeType) { | |||
msgModel = MsgModel(0, friendId.id, chat.cType.value, | |||
chat.contentBuff, chat.sendTime.toInt(), sessionId, | |||
channelType: ChatChannelType.Session.value); | |||
} | |||
///接到开始翻译管家消息-打开翻译管家聊天页面 | |||
if(notice.noticeType==TransHKChatNoticeType.StartChat){ | |||
Future.delayed(Duration(seconds: 1),(){ | |||
if (notice.noticeType == TransHKChatNoticeType.StartChat) { | |||
Future.delayed(Duration(seconds: 1), () { | |||
TranslateHKMgr().orderStatus = TranslateHKMgr.ORDER_STATUS_EMPTY; | |||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_REFRESH_ORDER ); | |||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_REFRESH_ORDER); | |||
curActiveSession = sessionId; | |||
print('curActiveSession:$curActiveSession'); | |||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_START_CHAT, friendId.id); | |||
MessageMgr() | |||
.emit(MessageMgr.TRANSLATE_HK_START_CHAT, friendId.id); | |||
}); | |||
}else if(notice.noticeType==TransHKChatNoticeType.EndChat){ | |||
} else if (notice.noticeType == TransHKChatNoticeType.EndChat) { | |||
print('chat.contentBuff cccc'); | |||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_END_CHAT, friendId.id); | |||
} | |||
@@ -485,6 +483,7 @@ class MsgHandler { | |||
//聊天消息 | |||
//time = DateTime.now().millisecondsSinceEpoch; | |||
//print('******收到聊天消息 $time'); | |||
UserData().shock(); | |||
int sessionId = chat.targetId; | |||
print('sessionId $sessionId'); | |||
if (isGroup) { | |||
@@ -588,7 +587,8 @@ class MsgHandler { | |||
debugPrint2('消息为空,无法保存'); | |||
return; | |||
} | |||
debugPrint2('收到消息,准备保存 会话Id:${msgModel.sessionId} friendId: ${msgModel.friendId} ChatType: ${msgModel.channelType}'); | |||
debugPrint2( | |||
'收到消息,准备保存 会话Id:${msgModel.sessionId} friendId: ${msgModel.friendId} ChatType: ${msgModel.channelType}'); | |||
// showToast('收到消息,准备保存 会话Id:${msgModel.sessionId} friendId: ${msgModel.friendId} ChatType: ${msgModel.channelType}'); | |||
ChatDataMgr().saveMsg(msgModel); | |||
if (msgModel.msgType == ChatType.ShortVoiceChatType.value) { | |||
@@ -833,8 +833,7 @@ class MsgHandler { | |||
ChatDataMgr().updateRecordWithUnreadMsg(noticeList); | |||
} | |||
static int msgCount=0; | |||
static int msgCount = 0; | |||
static handlerServerMsg(int comId, int msgId, List<int> content) { | |||
switch (comId) { | |||
@@ -917,10 +916,9 @@ class MsgHandler { | |||
LocalNotificationUtil.instance | |||
.show(I18n.of(context).notice, I18n.of(context).new_video_msg); | |||
playAudioRing(); | |||
if(TranslateHKMgr().order==null){ | |||
if (TranslateHKMgr().order == null) { | |||
MessageMgr().emit('Receive AudioChat Request', friendId); | |||
} | |||
} | |||
} else if (msgId == 14) { | |||
var msgContent = PushRealtimeCallRespond.fromBuffer(content); | |||
@@ -984,11 +982,11 @@ class MsgHandler { | |||
handlerCancelTranslateOrder(content); | |||
} else if (msgId == 20) { | |||
handlerDeliveryInterpreterOrderPush(content); | |||
}else if(msgId==21){ | |||
} else if (msgId == 21) { | |||
handlerCancellationTransHKOrderPush(content); | |||
}else if(msgId==8){ | |||
} else if (msgId == 8) { | |||
handlerEndTransHKOrderRes(content); | |||
}else if(msgId==10){ | |||
} else if (msgId == 10) { | |||
handlerTransHKInterSetIsReceiptRes(content); | |||
} | |||
break; | |||
@@ -1002,7 +1000,7 @@ class MsgHandler { | |||
switch (type) { | |||
case 'notice': | |||
///由于极光本地推送点击事件无反应,暂时不走这,由远端推 | |||
///由于极光本地推送点击事件无反应,暂时不走这,由远端推 | |||
String messageJson = map['message']; | |||
Map messageMap = json.decode(messageJson); | |||
@@ -1136,9 +1134,9 @@ class MsgHandler { | |||
Navigator.pushReplacement(context, | |||
MaterialPageRoute<void>(builder: (BuildContext context) { | |||
return GroupChatPage( | |||
key: Key('GroupChat'), groupInfoModel: groupInfoModel); | |||
})); | |||
return GroupChatPage( | |||
key: Key('GroupChat'), groupInfoModel: groupInfoModel); | |||
})); | |||
} else { | |||
switch (res.errorCode) { | |||
case 3007: | |||
@@ -1279,10 +1277,11 @@ class MsgHandler { | |||
} | |||
//发布翻译管家帮助订单 | |||
static sendCreateTranslateOrder(int fromLanguage,int toLanguage,int scences,String extraDesc) { | |||
TranslateHKMgr().isUser=true; | |||
debugPrint2('发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage|toLanguage}' ); | |||
static sendCreateTranslateOrder( | |||
int fromLanguage, int toLanguage, int scences, String extraDesc) { | |||
TranslateHKMgr().isUser = true; | |||
debugPrint2( | |||
'发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage | toLanguage}'); | |||
var seq = IssueTransHKOrderReq.create(); | |||
seq.tLanguage = fromLanguage | toLanguage; | |||
seq.scenes = scences; | |||
@@ -1305,29 +1304,24 @@ class MsgHandler { | |||
} else { | |||
debugPrint2('发布翻译管家帮助订单失败 ${res.errorCode}'); | |||
String errorStr=I18n.of(context).translation_butler_order_failed; | |||
switch(res.errorCode){ | |||
String errorStr = I18n.of(context).translation_butler_order_failed; | |||
switch (res.errorCode) { | |||
case 5014: | |||
errorStr=I18n.of(context).translation_butler_order_failed2; | |||
errorStr = I18n.of(context).translation_butler_order_failed2; | |||
break; | |||
case 5015: | |||
errorStr=I18n.of(context).not_enough; | |||
errorStr = I18n.of(context).not_enough; | |||
break; | |||
} | |||
showToast('$errorStr -${res.errorCode}',duration: Duration(seconds: 3)); | |||
showToast('$errorStr -${res.errorCode}', duration: Duration(seconds: 3)); | |||
TranslateHKMgr().orderStatus = TranslateHKMgr.ORDER_STATUS_EMPTY; | |||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_REFRESH_ORDER); | |||
} | |||
} | |||
//翻译官开启/关闭接收订单 | |||
static translateReceiptOrStopOrder(bool isReceipt) { | |||
debugPrint2('翻译官开启/关闭接收订单 请求 $isReceipt' ); | |||
debugPrint2('翻译官开启/关闭接收订单 请求 $isReceipt'); | |||
var seq = TransHKInterSetIsReceiptReq.create(); | |||
seq.isReceipt = isReceipt; | |||
@@ -1339,7 +1333,8 @@ class MsgHandler { | |||
debugPrint2('翻译官开启/关闭接收订单 回应'); | |||
var res = TransHKInterSetIsReceiptRes.fromBuffer(msgContent); | |||
if (res.errorCode == 0) { | |||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_IS_RECEIVED_ORDER,res.isReceipt); | |||
MessageMgr() | |||
.emit(MessageMgr.TRANSLATE_HK_IS_RECEIVED_ORDER, res.isReceipt); | |||
debugPrint2('翻译官开启/关闭接收订单 回应成功: ${res.isReceipt}'); | |||
} else { | |||
@@ -1347,7 +1342,6 @@ class MsgHandler { | |||
} | |||
} | |||
//撤销订单消息 | |||
static sendCancelTranslateOrder() { | |||
debugPrint2('取消订单 orderid:${TranslateHKMgr().orderId}'); | |||
@@ -1376,31 +1370,28 @@ class MsgHandler { | |||
'OrderId: ${res.orderId} createTime: ${res.createTime} tLanguage:${res.tLanguage} scenes:${res.scenes} desc${res.desc}'); | |||
TranslateOrder order = new TranslateOrder(); | |||
order.orderId=res.orderId; | |||
order.desc=res.desc; | |||
order.createTime=res.createTime.toInt(); | |||
order.tLanguage=res.tLanguage.toInt(); | |||
order.scenes=res.scenes.toInt(); | |||
order.orderId = res.orderId; | |||
order.desc = res.desc; | |||
order.createTime = res.createTime.toInt(); | |||
order.tLanguage = res.tLanguage.toInt(); | |||
order.scenes = res.scenes.toInt(); | |||
order.userName = res.employer.niceName; | |||
TranslateHKMgr().order = order; | |||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_RECEIVE_ORDER, order); | |||
} | |||
//派送订单已被取消 | |||
static handlerCancellationTransHKOrderPush(List<int> msgContent) { | |||
var res = CancellationTransHKOrderPush.fromBuffer(msgContent); | |||
debugPrint2('派送订单已被取消: orderId${res.orderId}'); | |||
// print('OrderId: ${res.orderId} createTime: ${res.createTime} tLanguage:${res.tLanguage} scenes:${res.scenes} desc${res.desc}'); | |||
TranslateHKMgr().order = null; | |||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_CANCEL_ORDER); | |||
showToast(I18n.of(context).translation_butler_order_time_out,duration: Duration(seconds: 3)); | |||
showToast(I18n.of(context).translation_butler_order_time_out, | |||
duration: Duration(seconds: 3)); | |||
} | |||
//接收订单请求 | |||
static sendReceiveOrder() { | |||
TranslateOrder order = TranslateHKMgr().order; | |||
@@ -1423,13 +1414,9 @@ class MsgHandler { | |||
} | |||
} | |||
//用户主动结束翻译管家服务 | |||
static sendEndTransHKOrderReq() { | |||
debugPrint2('用户主动结束翻译管家服务 ${TranslateHKMgr().orderId}' ); | |||
debugPrint2('用户主动结束翻译管家服务 ${TranslateHKMgr().orderId}'); | |||
var seq = EndTransHKOrderReq.create(); | |||
seq.orderId = TranslateHKMgr().orderId; | |||
NetWork().sendMsg(ComId.TranslateOrder, 7, seq); | |||
@@ -1440,7 +1427,6 @@ class MsgHandler { | |||
debugPrint2('用户主动结束翻译管家服务'); | |||
var res = EndTransHKOrderRes.fromBuffer(msgContent); | |||
if (res.errorCode == 0) { | |||
// GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); | |||
debugPrint2('用户主动结束翻译管家服务 成功: '); | |||
} else { | |||
@@ -1448,11 +1434,6 @@ class MsgHandler { | |||
} | |||
} | |||
//消息免打扰请求结果 | |||
static handlerGroupIsShowMenberNiceName(List<int> msgContent) { | |||
print('设置是否显示群昵称'); | |||