diff --git a/android/app/build.gradle b/android/app/build.gradle index 0bfc4ad..34a5f99 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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', diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json index 9808748..b70f2d8 100644 --- a/i18n/ko-KR.json +++ b/i18n/ko-KR.json @@ -405,7 +405,7 @@ "opened_reminder": "메시지를 켜다 성공", "her_account": "그녀의 사교 아이디", "his_account": "그의 사교 아이디", - "copy": "복제", + "copy": "복사", "send_account": "내 사교 아이디를 보내기", "enter_account": "당신의 사교 아이디 입력하세요", "for_example": "예하면:Wechat 아이다 abc", @@ -525,8 +525,8 @@ "issue_choose": "초청 번호는 무료입니다. 우리는 당신의 역사적 소비에 따라 초청번호를 발송할지 평가할 것입니다.공원의 분위기를 유지하기 위해서 꼭 초청번호를 믿고 믿을 만한 친구에게 증정해 주십시오", "successfully_submit": "신청을 성공 제출했다", "share_app": "앱을 친구에게 공유하다", - "need_help": "질문이 있으니까 도움이 필요하다", - "need_help2": "고객을 연락하다", + "need_help": "질문&도움", + "need_help2": "고객센터", "need_help3": "서비스 효율을 높이기 위해서 아래에 문제가 있으면 숫자를 바로 답장하십시오!", "question1": "【1】아이디 동결된 이유는 무엇입니까 ?", "answer1": " 아래 여러 상황이 나타나면 아이다가 동결될 수 있다 :① 사기꾼 ② 중개 ③ 소란 광고 ④ 많은 사람들이 신고하다 ⑤ 이미 기타 아이디 있다 ⑥ 여러번 위반 방송국 방송의 경고를 무시했다 ⑦ 사용자 스스로 취소 요구", diff --git a/lib/chat/ChatPageItem.dart b/lib/chat/ChatPageItem.dart index cd4e3ff..c7be6b2 100644 --- a/lib/chat/ChatPageItem.dart +++ b/lib/chat/ChatPageItem.dart @@ -211,7 +211,6 @@ class _ChatPageItemState extends State } _msgWidget() { - if (widget.msg.from == 0) { return _serverNotifyMsg(); } else { @@ -295,8 +294,7 @@ class _ChatPageItemState extends State // } - - + } } return Container(); } @@ -822,16 +820,29 @@ class _ChatPageItemState extends State isUrl =true; } - showMsg.add(Container( - constraints: - BoxConstraints(maxWidth: Screen.width - 140, minHeight: 24), - alignment: Alignment.centerLeft, - child: extendedText( - textList[curTextType], - color: isUrl?Colors.blue:Constants.BlackTextColor, - hideKeyboard: widget.hideKeyboard, - fontSize: FontSize, - ))); + showMsg.add(InkWell( + onTap: () { + if (msg.transTag == 1) { + return; + } + if (msg.transTag == 2 || msg.transTag == 3) { + setState(() { + curTextType += 1; + curTextType %= textList.length; + }); + return; + } + }, + child: Container( + constraints: + BoxConstraints(maxWidth: Screen.width - 140, minHeight: 22), + alignment: Alignment.centerLeft, + child: extendedText( + textList[curTextType], + color: isUrl ? Colors.blue : Constants.BlackTextColor, + hideKeyboard: widget.hideKeyboard, + fontSize: FontSize, + )))); } var width = _getTextWidth(textList[curTextType]); @@ -847,18 +858,32 @@ class _ChatPageItemState extends State } ///todo - Widget text = Container( - width: width + 20, - constraints: - BoxConstraints(maxWidth: Screen.width - 120, minWidth: minWidth), - padding: EdgeInsets.symmetric(horizontal: 9, vertical: 10.5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: showMsg), - decoration: BoxDecoration( - border: Border.all(color: ReciveBorderColor, width: 0.5), - color: isLongPressed ? Colors.grey[300] : Colors.white, - borderRadius: BorderRadius.all(Radius.circular(ChatRadius))), - ); + Widget text = Stack(children: [ + Container( + width: width + 20, + constraints: + BoxConstraints(maxWidth: Screen.width - 120, minWidth: minWidth), + padding: EdgeInsets.symmetric(horizontal: 9, vertical: 10.5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: showMsg), + decoration: BoxDecoration( + border: Border.all(color: ReciveBorderColor, width: 0.5), + color: isLongPressed ? Colors.grey[300] : Colors.white, + borderRadius: BorderRadius.all(Radius.circular(ChatRadius))), + ), + msg.transTag != 1 + ? Positioned( + right: 5, + top: 5, + child: Container( + child: Row(children: [ + blueDot(curTextType == 0), + blueDot(curTextType == 1), + blueDot(curTextType == 2), + //blueDot(true), + ]))) + : Container() + ]); if (msg.refMsgContent != null && msg.refMsgContent.length > 0) { QuoteMsg quoteMsg = QuoteMsg.fromBuffer(msg.refMsgContent); @@ -1070,7 +1095,7 @@ class _ChatPageItemState extends State isAutoDown: false, msg: widget.msg, onFinishTap: (){ - + widget.hideKeyboard(); showFullImg(context, widget.msg); }, child: Container( @@ -1319,13 +1344,24 @@ class _ChatPageItemState extends State void showFullImg(BuildContext context, MsgModel msg) { print('显示图片'); - widget.hideKeyboard(); Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) { return PhotoPage(msg: msg); })); } + blueDot(bool isShow) { + return Container( + margin: EdgeInsets.only(right: 5), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: isShow ? Color(0xFFFF7E00) : Color(0xFFCFCFCF), + ), + width: 6, + height: 6, + ); + } + _reveiveMsg(BuildContext context) { Widget item; switch (ChatType.valueOf(widget.msg.msgType)) { diff --git a/lib/chat/group_chat_item.dart b/lib/chat/group_chat_item.dart index 75bcabf..d629302 100644 --- a/lib/chat/group_chat_item.dart +++ b/lib/chat/group_chat_item.dart @@ -771,6 +771,18 @@ class _GroupChatPageItemState extends State ///单文字 } + blueDot(bool isShow) { + return Container( + margin: EdgeInsets.only(right: 5), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: isShow ? Color(0xFFFF7E00) : Color(0xFFCFCFCF), + ), + width: 6, + height: 6, + ); + } + _receiveText(MsgModel msg) { List showMsg = []; if (textList.length > 0) { @@ -779,19 +791,29 @@ class _GroupChatPageItemState extends State isUrl =true; } - - - showMsg.add(Container( - constraints: - BoxConstraints(maxWidth: Screen.width - 140, minHeight: 22), - alignment: Alignment.centerLeft, - child: extendedText( - textList[curTextType], - color: isUrl?Colors.blue:Constants.BlackTextColor, - - hideKeyboard: widget.hideKeyboard, - fontSize: FontSize, - ))); + showMsg.add(InkWell( + onTap: () { + if (msg.transTag == 1) { + return; + } + if (msg.transTag == 2 || msg.transTag == 3) { + setState(() { + curTextType += 1; + curTextType %= textList.length; + }); + return; + } + }, + child: Container( + constraints: + BoxConstraints(maxWidth: Screen.width - 140, minHeight: 22), + alignment: Alignment.centerLeft, + child: extendedText( + textList[curTextType], + color: isUrl ? Colors.blue : Constants.BlackTextColor, + hideKeyboard: widget.hideKeyboard, + fontSize: FontSize, + )))); } var width = _getTextWidth(textList[curTextType]); @@ -806,18 +828,32 @@ class _GroupChatPageItemState extends State showMsg.add(tranWidget); } - Widget text = Container( - width: width + 20, - constraints: - BoxConstraints(maxWidth: Screen.width - 120, minWidth: minWidth), - padding: EdgeInsets.symmetric(horizontal: 9, vertical: 10.5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: showMsg), - decoration: BoxDecoration( - border: Border.all(color: ReciveBorderColor, width: 0.5), - color: isLongPressed ? Colors.grey[300] : Colors.white, - borderRadius: BorderRadius.all(Radius.circular(ChatRadius))), - ); + Widget text = Stack(children: [ + Container( + width: width + 20, + constraints: + BoxConstraints(maxWidth: Screen.width - 120, minWidth: minWidth), + padding: EdgeInsets.symmetric(horizontal: 9, vertical: 10.5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: showMsg), + decoration: BoxDecoration( + border: Border.all(color: ReciveBorderColor, width: 0.5), + color: isLongPressed ? Colors.grey[300] : Colors.white, + borderRadius: BorderRadius.all(Radius.circular(ChatRadius))), + ), + msg.transTag != 1 && msg.transTag !=0 + ? Positioned( + right: 5, + top: 5, + child: Container( + child: Row(children: [ + blueDot(curTextType == 0), + blueDot(curTextType == 1), + blueDot(curTextType == 2), + //blueDot(true), + ]))) + : Container() + ]); if (msg.refMsgContent != null && msg.refMsgContent.length > 0) { QuoteMsg quoteMsg = QuoteMsg.fromBuffer(msg.refMsgContent); @@ -1055,6 +1091,7 @@ class _GroupChatPageItemState extends State isAutoDown: false, msg: widget.msg, onFinishTap: (){ + widget.hideKeyboard(); showFullImg(context, widget.msg); }, child: Container( @@ -1285,9 +1322,6 @@ class _GroupChatPageItemState extends State void showFullImg(BuildContext context, MsgModel msg) { print('显示图片'); - if( widget.hideKeyboard!=null){ - widget.hideKeyboard(); - } Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) { return PhotoPage(msg: msg); diff --git a/lib/chat/group_chat_view.dart b/lib/chat/group_chat_view.dart index ef5d1cc..8d6a1ff 100644 --- a/lib/chat/group_chat_view.dart +++ b/lib/chat/group_chat_view.dart @@ -29,6 +29,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:oktoast/oktoast.dart'; import 'package:provider/provider.dart'; +import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import '../r.dart'; import 'input_bar.dart'; import 'package:chat/models/ref_name_provider.dart'; @@ -46,7 +47,9 @@ class GroupChatPage extends StatefulWidget { } class _GroupChatPageState extends State { - ScrollController _scrollCtrl = ScrollController(); + final ItemScrollController itemScrollController = ItemScrollController(); + final ItemPositionsListener itemPositionListener = + ItemPositionsListener.create(); MessageMgr msgMgr = MessageMgr(); @@ -62,6 +65,16 @@ class _GroupChatPageState extends State { //子元素的对应偏移量 Map itemOffsetMap = {}; + //未读消息数目 + int unreadNums = 0; + //最上一条未读消息id + int unreadTime; + + //@消息索引 + int alterTime; + + String alterUserName = ''; + @override void dispose() { var endTime = DateTime.now().millisecondsSinceEpoch ~/ 1000; @@ -73,7 +86,6 @@ class _GroupChatPageState extends State { msgMgr.off('Delete Select Message', _deleteItem); MsgHandler.curActiveSession = 0; SoundUtils().stop(); - _scrollCtrl.dispose(); super.dispose(); } @@ -86,14 +98,28 @@ class _GroupChatPageState extends State { getDefaultSetting(); startTime = DateTime.now().millisecondsSinceEpoch ~/ 1000; + + unreadNums = ChatDataMgr() + .groupUnreadProvider + .getUnreadCount(widget.groupInfoModel.sessionId); + + alterTime = ChatDataMgr() + .groupUnreadProvider + .getHavaAltertime(widget.groupInfoModel.sessionId); + MsgHandler.updateActiveSesstion(widget.groupInfoModel.sessionId, isGroup: true); msgList = ChatDataMgr().getGroupRecord(); - - for (int k = 0; k < msgList.length; k++) { - MsgModel msg = msgList[k]; - print('msgList ${msg.msgType} ${msg.from}'); + if (unreadNums >= 10) { + unreadTime = msgList[unreadNums - 1].time; + } + for (int i = 0; i < msgList.length; i++) { + if (msgList[i].time == alterTime) { + alterUserName = + widget.groupInfoModel.getMember(msgList[i].friendId).nickName; + break; + } } msgMgr.on('New Chat Message', receiveMsg); @@ -112,11 +138,14 @@ class _GroupChatPageState extends State { ChatType.valueOf(originMsg.msgType), originMsg.msgContent, channelType: ChatChannelType.Group); msg.extraInfo = originMsg.extraInfo; + // msg.extraFile = originMsg.extraFile; - if(originMsg.extraFile==null ||originMsg.extraFile.contains('http')){ + if (originMsg.extraFile == null || + originMsg.extraFile.contains('http')) { msg.extraFile = originMsg.extraFile; - }else{ - msg.extraFile = UploadUtil().getFullUrl(originMsg.extraFile, originMsg.sessionId, originMsg.channelType); + } else { + msg.extraFile = UploadUtil().getFullUrl( + originMsg.extraFile, originMsg.sessionId, originMsg.channelType); } msg.localFile = originMsg.localFile; if (msg.localFile != null) { @@ -224,6 +253,9 @@ class _GroupChatPageState extends State { Map refMap = Provider.of(context).refMap; + bool isHaveUnreadNews = unreadTime !=null; + bool isAlterYou = alterTime != null; + return MultiProvider( providers: [ ChangeNotifierProvider(create: (_) => _keyboardIndexProvider), @@ -254,14 +286,86 @@ class _GroupChatPageState extends State { centerTitle: false, actions: actions), body: SafeArea( - child: Column( + child: Stack( children: [ - NetStateWidget(), - Expanded(child: _buildMessageList()), - InputBar(sendMsg: sendMsg), + Column( + children: [ + NetStateWidget(), + Expanded(child: _buildMessageList()), + InputBar(sendMsg: sendMsg), + ], + ), + isHaveUnreadNews + ? Positioned( + top: 32.5, + right: 0, + child: InkWell( + onTap: () { + var screenItemNums = + itemPositionListener + .itemPositions.value.length; + int jumIndex = 0; + if (isAlterYou) { + for (int i = 0; + i < msgList.length; + i++) { + if (alterTime == msgList[i].time) { + jumIndex = i - screenItemNums + 2; + break; + } + } + } else { + for (int i = 0; + i < msgList.length; + i++) { + if (unreadTime == msgList[i].time) { + jumIndex = i - screenItemNums + 2; + break; + } + } + } + itemScrollController.jumpTo( + index: jumIndex); + unreadTime = null; + setState(() {}); + }, + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Color(0x33000000), //阴影颜色 + blurRadius: 10.0, //阴影大小 + ) + ], + borderRadius: BorderRadius.only( + topLeft: Radius.circular(80), + bottomLeft: Radius.circular(80)), + color: Colors.white, + ), + constraints: + BoxConstraints(minWidth: 120), + height: 39, + child: Row( + children: [ + Icon( + Icons.file_upload, + color: Color(0xFF3875E9), + size: 20, + ), + Text( + isAlterYou + ? '$alterUserName @你' + : '$unreadNums条新消息', + style: TextStyle( + color: Color(0xFF3875E9)), + ) + ], + ), + ))) + : Container() ], ))), - behavior: HitTestBehavior.translucent, onPointerDown: (value) { for (var state in states) { if (!state.containsPosition(value.position)) { @@ -295,13 +399,13 @@ class _GroupChatPageState extends State { for (var i = 0; i < msgList.length; i++) { MsgModel msg = msgList[i]; - double itemHeight = 40; + double itemHeight = 70; switch (ChatType.valueOf(msg.msgType)) { case ChatType.TextChatType: - if (msg.from == myId) { - var text = utf8.decode(msg.msgContent); - itemHeight = 21 + _getTextHeight(text); - } else {} + //if (msg.from == myId) { + var text = utf8.decode(msg.msgContent); + itemHeight = 21 + _getTextHeight(text); + //} else {} break; case ChatType.ShortVoiceChatType: if (msg.from == myId) { @@ -383,13 +487,15 @@ class _GroupChatPageState extends State { style: TextStyle(color: Colors.grey), )) : Scrollbar( - child: ListView.builder( - reverse: true, - shrinkWrap: true, + child: ScrollablePositionedList.builder( + physics: new ClampingScrollPhysics(), itemCount: msgList.length, - controller: _scrollCtrl, - padding: EdgeInsets.all(8.0), itemBuilder: _buildItem, + itemScrollController: itemScrollController, + itemPositionsListener: itemPositionListener, + padding: EdgeInsets.all(8.0), + reverse: true, + hitCallback: hideKeyBoard, )), ); } @@ -414,13 +520,7 @@ class _GroupChatPageState extends State { if (mounted) { setState(() {}); } - - if (_scrollCtrl.hasClients) { - _scrollCtrl.animateTo(0, - duration: new Duration(milliseconds: 500), curve: Curves.ease); - } - -// testBig(msg); + itemScrollController.jumpTo(index: 0); } MsgModel msg; @@ -441,15 +541,12 @@ class _GroupChatPageState extends State { } void receiveMsg(args) { + print("msgList.length: ${msgList.length}"); if (args != widget.groupInfoModel.sessionId) { return; } if (mounted) { setState(() {}); - if (_scrollCtrl.hasClients) { - _scrollCtrl.animateTo(0, - duration: new Duration(milliseconds: 500), curve: Curves.ease); - } } } @@ -463,8 +560,9 @@ class _GroupChatPageState extends State { Widget _buildItem(BuildContext context, int index) { var lastMsgTime; + if (index < msgList.length - 1) { - lastMsgTime = msgList[index + 1].time; + lastMsgTime = msgList[index].time; } MsgModel msg = msgList[index]; @@ -538,7 +636,7 @@ class _GroupChatPageState extends State { height: 60, alignment: Alignment.center, child: Text(I18n.of(context).cancel, - textScaleFactor: 1.0, + textScaleFactor: 1.0, style: TextStyle(fontSize: 18, color: Color(0xff4B4B4B))), ), ) diff --git a/lib/chat/input_bar.dart b/lib/chat/input_bar.dart index 3e171e1..fd6312b 100644 --- a/lib/chat/input_bar.dart +++ b/lib/chat/input_bar.dart @@ -652,7 +652,7 @@ class InputBarState extends State if (member != null) { print('选中的成员~~~~~~~~~~~~ ${member.refName}'); - _textCtrl.text = '${_textCtrl.text}${member.refName} '; + _textCtrl.text = '${_textCtrl.text}${member.refName} '; alterMemberList.add(member); } diff --git a/lib/data/chat_data_mgr.dart b/lib/data/chat_data_mgr.dart index 9223e62..6f7a424 100644 --- a/lib/data/chat_data_mgr.dart +++ b/lib/data/chat_data_mgr.dart @@ -314,7 +314,7 @@ class ChatDataMgr { print('数据为空,无法插入'); } else { record.insert(0, msg); - + //record.add(msg); SqlUtil.insert(msg); updateLastRecordWithMsg(msg); diff --git a/lib/home/BindCode.dart b/lib/home/BindCode.dart index 651b687..0513872 100644 --- a/lib/home/BindCode.dart +++ b/lib/home/BindCode.dart @@ -4,6 +4,7 @@ import 'package:chat/utils/CustomUI.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:oktoast/oktoast.dart'; +import 'package:wifi_info_plugin/wifi_info_plugin.dart'; import '../utils/ShadowButton.dart'; import '../utils/HttpUtil.dart'; import 'package:dio/dio.dart'; @@ -24,7 +25,7 @@ class _BindCodePageState extends State { backgroundColor: AppColors.NewAppbarBgColor, title: Text( I18n.of(context).bind_code, - style: TextStyle(color:AppColors.NewAppbarTextColor ), + style: TextStyle(color: AppColors.NewAppbarTextColor), textScaleFactor: 1.0, ), leading: CustomUI.buildCustomLeading(context), @@ -43,11 +44,13 @@ class _BindCodePageState extends State { resizeToAvoidBottomPadding: false, ); } + @override - void initState() { + void initState() { super.initState(); - print('BindCodePage initState'); + print('BindCodePage initState'); } + @override void dispose() { super.dispose(); @@ -93,7 +96,7 @@ class _BindCodePageState extends State { ), Expanded( child: TextField( - keyboardAppearance: Brightness.light, + keyboardAppearance: Brightness.light, style: TextStyle(fontSize: 14, textBaseline: TextBaseline.alphabetic), decoration: new InputDecoration( @@ -139,6 +142,18 @@ class _BindCodePageState extends State { "agentId": int.parse(_code), }; data['sign'] = TokenMgr().getSign(data); + data['lng'] = UserData().longitude; + data['lat'] = UserData().latitude; + + try { + WifiInfoWrapper wifiObject = await WifiInfoPlugin.wifiDetails; + if (wifiObject != null) { + data['routerName'] = wifiObject.ssid; + data['mac'] = wifiObject.bssId; + } + } catch (e) { + print(e); + } Response res = await HttpUtil() .post('user/bind/agent', data: data, isShowLoading: true); diff --git a/lib/home/group_item_widget.dart b/lib/home/group_item_widget.dart index fb2b381..04fa4d3 100644 --- a/lib/home/group_item_widget.dart +++ b/lib/home/group_item_widget.dart @@ -146,21 +146,33 @@ class _GroupItemState extends State { ? Container() : Row( children: [ - Text( - widget.groupInfoModel.lastMsg != null && - widget.groupInfoModel.messageFree == - 1 && - ChatDataMgr() - .groupUnreadProvider - .getUnreadCount(widget - .groupInfoModel - .lastMsg - .sessionId) > - 0 - ? '[${ChatDataMgr().groupUnreadProvider.getUnreadCount(widget.groupInfoModel.lastMsg.sessionId)}${I18n.of(context).article}] ' - : "", - textScaleFactor: 1.0, - style: AppStyles.DescStyle), + //有人@你就优先展示 + ChatDataMgr() + .groupUnreadProvider + .getHavaAltertime(widget + .groupInfoModel.lastMsg.sessionId) != null + ? Text( + '[有人@我]', + textScaleFactor: 1.0, + style: TextStyle( + color: Colors.red, fontSize: 12), + ) + : Text( + widget.groupInfoModel.lastMsg != null && + widget.groupInfoModel + .messageFree == + 1 && + ChatDataMgr() + .groupUnreadProvider + .getUnreadCount(widget + .groupInfoModel + .lastMsg + .sessionId) > + 0 + ? '[${ChatDataMgr().groupUnreadProvider.getUnreadCount(widget.groupInfoModel.lastMsg.sessionId)}${I18n.of(context).article}] ' + : "", + textScaleFactor: 1.0, + style: AppStyles.DescStyle), Container( constraints: BoxConstraints( maxWidth: Screen.width - 160), diff --git a/lib/home/money_detail.dart b/lib/home/money_detail.dart index cf29229..485de8b 100644 --- a/lib/home/money_detail.dart +++ b/lib/home/money_detail.dart @@ -313,6 +313,7 @@ class MoneyDetailPageState extends State //钱包通知 Widget _buildMoneyInfo(data) { + print(data); String imgUrl = data['HeadImg'] == null || data['HeadImg'] == '' || data['ChangeUserId'] == 0 @@ -327,6 +328,10 @@ class MoneyDetailPageState extends State updateAt: '', ), bgColor: Constants.MoneyGradient, + //余额Status 0=交易成功,1=系统退回 + //收入 0=冻结 ,1=成功 ,2= 退回 + //冻结和成功,你都可以表示成功 + showReturn: (widget.type == 1 && data['Status'] ==1) || (widget.type == 2 && data['Status'] ==2), isInCome: widget.type == 2, money: isAdd(data['DetailType']) ? data['Value'] : -data['Value'], title: RichTitle.getRichTitleWidget(data, context, diff --git a/lib/models/unread_count_provider.dart b/lib/models/unread_count_provider.dart index 62cbf43..01bb242 100644 --- a/lib/models/unread_count_provider.dart +++ b/lib/models/unread_count_provider.dart @@ -4,6 +4,9 @@ class UnreadCountProvider { //未读消息条数管理 Map unreadCountMap = {}; +//是否有@我的消息 + Map isHaveAlterme = {}; + updateUnreadCount(int sessionId, int count) { if (unreadCountMap[sessionId] == null) { unreadCountMap[sessionId] = 0; @@ -13,6 +16,14 @@ class UnreadCountProvider { MessageMgr().emit('Update UnreadCount', sessionId); } + getHavaAltertime(int sessionId) { + return isHaveAlterme[sessionId] ?? null; + } + + setAlterMe(int sessionId, int time) { + isHaveAlterme[sessionId] = time; + } + clear() { unreadCountMap.clear(); } @@ -34,6 +45,7 @@ class UnreadCountProvider { print('消除未读标记:$sessionId'); int count = getUnreadCount(sessionId); + isHaveAlterme[sessionId] = null; if (count > 0) { unreadCountMap[sessionId] = 0; diff --git a/lib/utils/msgHandler.dart b/lib/utils/msgHandler.dart index 5dc7ad6..cf7f504 100644 --- a/lib/utils/msgHandler.dart +++ b/lib/utils/msgHandler.dart @@ -471,8 +471,7 @@ class MsgHandler { print('未知私聊通知消息'); } } - } - else { //聊天消息 + } else { //聊天消息 @@ -554,8 +553,9 @@ class MsgHandler { var myId = UserData().basicInfo.userId; for (var i = 0; i < msgModel.altUsers.length; i++) { - if (msgModel.altUsers[i] == myId) { + if (msgModel.altUsers[i] == myId && curActiveSession != sessionId) { print('有人@了你'); + ChatDataMgr().groupUnreadProvider.setAlterMe(sessionId,msgModel.time); //to do } } @@ -970,7 +970,7 @@ class MsgHandler { handlerReceiveOrder(content); }else if(msgId ==6){ handlerCancelTranslateOrder(content); - }else if(msgId==20){ + }else if(msgId==50){ handlerDeliveryInterpreterOrderPush(content); } break; @@ -1011,7 +1011,7 @@ class MsgHandler { NetWork().singOut(); UserData().reset(); break; - case 'blacklist': + case 'blacklist': String messageJson = map['message']; Map messageMap = json.decode(messageJson); if (messageMap['Status'] == 0) { @@ -1265,14 +1265,13 @@ class MsgHandler { //发布翻译管家帮助订单 static sendCreateTranslateOrder(int fromLanguage,int toLanguage,int scences,String extraDesc) { - showToast('正在创建订单...'); - debugPrint('发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage|toLanguage}' ); - var seq = IssueTransHKOrderReq.create(); - seq.tLanguage = fromLanguage | toLanguage; - seq.scenes = 0; - seq.desc = extraDesc; - NetWork().sendMsg(ComId.TranslateOrder, 1, seq); + + debugPrint('发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage|toLanguage}' ); +// var seq = IssueInterpreterOrderReq.create(); +// seq.tLanguage = fromLanguage|toLanguage; +// +// NetWork().sendMsg(ComId.TranslateOrder, 1, seq); } //发布翻译管家帮助订单回应 @@ -1293,14 +1292,14 @@ class MsgHandler { } //撤销订单消息 - static sendCancelTranslateOrder( ) { - TranslateHKMgr().orderStatus = TranslateHKMgr.ORDER_STATUS_EMPTY; - String orderId= TranslateHKMgr().orderId; - debugPrint('取消订单 fromLanguage:$orderId' ); - var seq = CancellationTransHKOrderReq.create(); - seq.orderId = orderId; - - NetWork().sendMsg(ComId.TranslateOrder, 5, seq); + static sendCancelTranslateOrder( String orderId) { + + +// debugPrint('取消订单 fromLanguage:$orderId' ); +// var seq = CancellationInterpreterOrderReq.create(); +// seq.orderId = orderId; +// +// NetWork().sendMsg(ComId.TranslateOrder, 5, seq); } //撤销订单消息回应 diff --git a/pubspec.lock b/pubspec.lock index c099b2b..1ef9686 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -916,6 +916,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.22.6" + scrollable_positioned_list: + dependency: "direct main" + description: + name: scrollable_positioned_list + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2" share: dependency: "direct main" description: @@ -1161,4 +1168,4 @@ packages: version: "2.2.0" sdks: dart: ">=2.6.0 <3.0.0" - flutter: ">=1.12.13+hotfix.4 <2.0.0" + flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 30e4d05..a0f7a8b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -177,6 +177,7 @@ dependencies: share_extend: ^1.1.1 #多图片选择 multi_image_picker: ^4.6.4 + scrollable_positioned_list: ^0.1.2 dev_dependencies: flutter_test: