瀏覽代碼

修改实时帮界面/优化本地群推送/

master
jiahao 5 年之前
父節點
當前提交
99e898e284
共有 20 個文件被更改,包括 258 次插入95 次删除
  1. +3
    -1
      i18n/en-US.json
  2. +3
    -1
      i18n/ja-JP.json
  3. +3
    -1
      i18n/ko-KR.json
  4. +3
    -1
      i18n/vi-VN.json
  5. +3
    -1
      i18n/zh-CN.json
  6. +4
    -1
      i18n/zh-HK.json
  7. +31
    -6
      lib/chat/ChatPage.dart
  8. +4
    -4
      lib/chat/ChatPageItem.dart
  9. +1
    -0
      lib/chat/group_chat_item.dart
  10. +23
    -0
      lib/chat/group_chat_view.dart
  11. +34
    -0
      lib/generated/i18n.dart
  12. +5
    -5
      lib/home/realtimehelper/real_time_helper_page.dart
  13. +119
    -64
      lib/home/realtimehelper/translation_butler_page.dart
  14. +3
    -1
      lib/home/realtimehelper/translation_evaluation_dialog.dart
  15. +2
    -2
      lib/home/realtimehelper/travel_butler_page.dart
  16. +1
    -1
      lib/home/unread_dot_widget.dart
  17. +1
    -1
      lib/utils/CustomUI.dart
  18. +1
    -1
      lib/utils/group_info_table.dart
  19. +1
    -1
      lib/utils/local_notification_util.dart
  20. +13
    -3
      lib/utils/msgHandler.dart

+ 3
- 1
i18n/en-US.json 查看文件

@@ -1213,7 +1213,9 @@
"translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
}

+ 3
- 1
i18n/ja-JP.json 查看文件

@@ -1213,5 +1213,7 @@
"translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
}

+ 3
- 1
i18n/ko-KR.json 查看文件

@@ -1212,5 +1212,7 @@
"translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
}

+ 3
- 1
i18n/vi-VN.json 查看文件

@@ -1213,5 +1213,7 @@
"translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
}

+ 3
- 1
i18n/zh-CN.json 查看文件

@@ -1213,5 +1213,7 @@
"translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
}

+ 4
- 1
i18n/zh-HK.json 查看文件

@@ -1213,6 +1213,9 @@
"translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
}

+ 31
- 6
lib/chat/ChatPage.dart 查看文件

@@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'package:fixnum/fixnum.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:chat/chat/translate_state.dart';
import 'package:chat/data/UserData.dart';
@@ -493,7 +494,7 @@ class _ChatPageState extends State<ChatPage> {
return Container(
margin: EdgeInsets.all(10),
child: Card(
elevation: 5,
elevation: 2,
// 阴影
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
@@ -509,19 +510,20 @@ class _ChatPageState extends State<ChatPage> {
isStart?I18n.of(context).translation_butler_start_service:I18n.of(context).translation_butler_service_end,
textScaleFactor: 1.0,
style: TextStyle(
color: AppColors.NewAppbarTextColor, fontSize: 15),
color: AppColors.NewAppbarTextColor, fontSize: 14),
),
SizedBox(height: 5,),
Text(
isStart?I18n.of(context).translation_butler_start_tips:I18n.of(context).translation_butler_evaluation_tips,
textScaleFactor: 1.0,
style: TextStyle(
color: AppColors.NewAppbarTextColor, fontSize: 13),
color:Color(0xFF797979), fontSize: 11),
)
],
),
isStart?Container():Expanded(child: Container(
margin: EdgeInsets.only(left: 15 ),
height: 30,
height: 35,
child: RaisedButton(
color: Color(0xff3875E9),
shape: RoundedRectangleBorder(
@@ -529,7 +531,7 @@ class _ChatPageState extends State<ChatPage> {
child: Text(
I18n.of(context).translation_butler_evaluation ,
textScaleFactor: 1.0,
style: TextStyle(color: Colors.white, fontSize: 19),
style: TextStyle(color: Colors.white, fontSize: 15),
),
onPressed:(){
CustomUI.buildTranslationEvaluationDialog(context);
@@ -603,8 +605,31 @@ class _ChatPageState extends State<ChatPage> {
duration: new Duration(milliseconds: 500), curve: Curves.ease);
}
}
// testBig(msg);
}
MsgModel msg;
int count=0;
testBig(MsgModel msg)async{
for(int k=0;k<100;k++){
msg.msgContent = utf8.encode('测试$count');
Int64 time = Int64((DateTime.now()).millisecondsSinceEpoch);
msg.time = time.toInt();
MsgHandler.insertMsgToDB(msg);
MsgHandler.sendChatMsg(msg);
await Future.delayed(Duration(milliseconds: 500),(){});
count++;
}
count=0;
print('发送完毕');
showToast('发送完毕');
}
void receiveMsg(args) {
if (mounted) {
setState(() {});


+ 4
- 4
lib/chat/ChatPageItem.dart 查看文件

@@ -662,8 +662,8 @@ class _ChatPageItemState extends State<ChatPageItem>
SoundUtils.instance.savePlayModeConfig(soundPlayMode);
});
}
return WPopupMenu(
// String date2 = DateTime.fromMillisecondsSinceEpoch(widget.msg.time).toString();
return WPopupMenu(
child: item,
actions: actions,
onLongPressStart: () {
@@ -709,11 +709,11 @@ class _ChatPageItemState extends State<ChatPageItem>
RegExp alterStr = RegExp(r'\[([0-9]+)\]');
Iterable<Match> matches = alterStr.allMatches(text);
print('~~~~~~~~~~~~~~${matches.length}~~~~~~~~~~~~~~~');
// print('~~~~~~~~~~~~~~${matches.length}~~~~~~~~~~~~~~~');
double delta = 0;
for (Match m in matches) {
print('~~~~~~~~~~~~~~${m.group(1)}~~~~~~~~~~~~~~~');
// print('~~~~~~~~~~~~~~${m.group(1)}~~~~~~~~~~~~~~~');
if (int.parse(m.group(1)) > 10) {
delta += 20 + 4 - 25;
} else {


+ 1
- 0
lib/chat/group_chat_item.dart 查看文件

@@ -595,6 +595,7 @@ class _GroupChatPageItemState extends State<GroupChatPageItem>
SoundUtils.instance.savePlayModeConfig(soundPlayMode);
});
}
// String date2 = DateTime.fromMillisecondsSinceEpoch(widget.msg.time).toString();
return WPopupMenu(
child: item,


+ 23
- 0
lib/chat/group_chat_view.dart 查看文件

@@ -31,6 +31,7 @@ import 'package:provider/provider.dart';
import '../r.dart';
import 'input_bar.dart';
import 'package:chat/models/ref_name_provider.dart';
import 'package:fixnum/fixnum.dart';
class GroupChatPage extends StatefulWidget {
@@ -419,6 +420,28 @@ class _GroupChatPageState extends State<GroupChatPage> {
_scrollCtrl.animateTo(0,
duration: new Duration(milliseconds: 500), curve: Curves.ease);
}
// testBig(msg);
}
MsgModel msg;
int count=0;
testBig(MsgModel msg)async{
for(int k=0;k<100;k++){
msg.msgContent = utf8.encode('测试$count');
Int64 time = Int64((DateTime.now()).millisecondsSinceEpoch);
msg.time = time.toInt();
MsgHandler.insertMsgToDB(msg);
MsgHandler.sendChatMsg(msg);
await Future.delayed(Duration(milliseconds: 300),(){});
count++;
}
count=0;
print('攻击完毕');
showToast('攻击完毕');
}
void receiveMsg(args) {


+ 34
- 0
lib/generated/i18n.dart 查看文件

@@ -2463,6 +2463,10 @@ class I18n implements WidgetsLocalizations {
String get translation_scenes_3 => "KTV/酒吧";
/// "其他"
String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
String get translation_more_desc => "更多描述";
}

class _I18n_en_US extends I18n {
@@ -6120,6 +6124,12 @@ class _I18n_vi_VN extends I18n {
/// "其他"
@override
String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";

@override
TextDirection get textDirection => TextDirection.ltr;
@@ -9773,6 +9783,12 @@ class _I18n_zh_HK extends I18n {
/// "其他"
@override
String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";

@override
TextDirection get textDirection => TextDirection.ltr;
@@ -13426,6 +13442,12 @@ class _I18n_zh_CN extends _I18n_zh_HK {
/// "其他"
@override
String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";

@override
TextDirection get textDirection => TextDirection.ltr;
@@ -17076,6 +17098,12 @@ class _I18n_ko_KR extends I18n {
/// "其他"
@override
String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";

@override
TextDirection get textDirection => TextDirection.ltr;
@@ -20729,6 +20757,12 @@ class _I18n_ja_JP extends I18n {
/// "其他"
@override
String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";

@override
TextDirection get textDirection => TextDirection.ltr;


+ 5
- 5
lib/home/realtimehelper/real_time_helper_page.dart 查看文件

@@ -58,7 +58,7 @@ class RealTimeHelperPageState extends State<RealTimeHelperPage> {
builder: (_) => TranslationButlerPage(),
),
);
}),
},textColor: Color(0xff2685FA)),
helperCard(
I18n.of(context).travel_butler, R.assetsImagesImgTravelButler,
() {
@@ -67,7 +67,7 @@ class RealTimeHelperPageState extends State<RealTimeHelperPage> {
builder: (_) => TravelButlerPage(),
),
);
}),
},textColor: Color(0xffff682d)),
SizedBox(
height: 15,
),
@@ -78,12 +78,12 @@ class RealTimeHelperPageState extends State<RealTimeHelperPage> {
);
}

Widget helperCard(String title, String assets, Function callBack) {
Widget helperCard(String title, String assets, Function callBack,{Color textColor }) {
return InkWell(
child: Container(
margin: EdgeInsets.all(10),
child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25),
@@ -98,7 +98,7 @@ class RealTimeHelperPageState extends State<RealTimeHelperPage> {
child: Text(
title + ' >>',
textScaleFactor: 1.0,
style: TextStyle(color: Color(0xff2685FA), fontSize: 20),
style: TextStyle(color: textColor, fontSize: 20),
),
)
],


+ 119
- 64
lib/home/realtimehelper/translation_butler_page.dart 查看文件

@@ -51,16 +51,29 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {

String extraMsg;

FocusNode focusNode = new FocusNode();

String textLimitTips='';
ScrollController _scrollController = new ScrollController();

@override
void initState() {
super.initState();

initData();


focusNode.addListener((){
if(focusNode.hasFocus){

}
});


WidgetsBinding.instance.addPostFrameCallback((_) {


Future.delayed(Duration(seconds: 2), () {
Future.delayed(Duration(seconds: 4), () {
// CustomUI.buildTranslationHelperOrderDialog(context);
Navigator.of(context).push(
new MaterialPageRoute(
@@ -112,6 +125,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
void didChangeDependencies() {
super.didChangeDependencies();

textLimitTips = I18n.of(context).translation_input_limit.replaceAll('/s1', '80');
langList = [
I18n.of(context).english,
I18n.of(context).Vietnamese,
@@ -147,22 +161,22 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {

return myPop.PopupMenuButton(
child: Container(
height: 40,
height: 37,
width: double.maxFinite,
decoration: BoxDecoration(
color: Color(0xffD3E7FF),
borderRadius: BorderRadius.circular(10)),
borderRadius: BorderRadius.circular(5)),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
langList[curIndex],
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
textScaleFactor: 1.0,
style: TextStyle(color: Color(0xff4A5E76), fontSize: 14),
)),
child: Container(padding: EdgeInsets.only(left: 5),alignment: Alignment.center,child: Text(
langList[curIndex],
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
textScaleFactor: 1.0,
style: TextStyle(color: Color(0xff4A5E76), fontSize: 14),
),)),
Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily),
size: 30, color: Color(0xff4A5E76))
],
@@ -210,27 +224,33 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
child: Container(
height: 40,
width: double.maxFinite,
child: Card(
elevation: 2, // 阴影
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
scenesList[curIndex],
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
textScaleFactor: 1.0,
style: TextStyle(color: Color(0xff3875E9), fontSize: 14),
)),
Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily),
size: 30, color: Color(0xff4A5E76))
],
),
decoration:BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x739f9f9f),
offset: Offset(0.2, 0.4),
blurRadius: 1.0,
spreadRadius: 0.6),
// BoxShadow(
// color: Color(0x9900FF00), offset: Offset(1.0, 1.0)),
// BoxShadow(color: Color(0xFF0000FF))
]),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
scenesList[curIndex],
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
textScaleFactor: 1.0,
style: TextStyle(color: Color(0xff3875E9), fontSize: 14),
)),
Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily),
size: 30, color: Color(0xff4A5E76))
],
),
),
offset: Offset(0, 100),
@@ -246,7 +266,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
(int i) {
return myPop.PopupMenuItem(
child: Container(
width: Screen.width / 2 - 40,
width: Screen.width *0.43,
alignment: Alignment.center,
color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
@@ -302,6 +322,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {

Widget applyPage() {
return ListView(
controller: _scrollController,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 20, right: 10, top: 15),
@@ -336,6 +357,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
),
Row(
children: <Widget>[
SizedBox(width: 15,),
Expanded(
child: _langPopMenu(true),
flex: 5,
@@ -367,9 +389,11 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
child: _langPopMenu(false),
flex: 5,
),
SizedBox(width: 15,),
],
),
Row(

children: <Widget>[
Expanded(
child: Image.asset(
@@ -377,10 +401,11 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
width: 195,
height: 175,
),
flex: 1,
flex: 4,
),
Expanded(
child: Column(

children: <Widget>[
Text(
I18n.of(context).translation_butler_scenes,
@@ -388,48 +413,73 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
textAlign: TextAlign.left,
style: TextStyle(
color: AppColors.NewAppbarTextColor,
fontWeight: FontWeight.w700,
fontSize: 15),
),
SizedBox(height: 10,),
_scenesPopMenu(),
],
),
flex: 1,
flex: 6,
)
],
),
Container(
alignment: Alignment.topLeft,
height: 100.5,
width: Screen.width-50,
padding: EdgeInsets.only(left: 17),
// constraints: BoxConstraints(
// minHeight: 82,
// ),
decoration: BoxDecoration(
color: Color(0xFFE9EEF4),
borderRadius: BorderRadius.all(Radius.circular(10))),
child: TextField(
keyboardAppearance: Brightness.light,
decoration: new InputDecoration(
hintText: I18n.of(context).set_password2,
hintStyle: TextStyle(fontSize: 14),
border: InputBorder.none,
),
Stack(children: <Widget>[

Container(
alignment: Alignment.topLeft,
height: 110.5,
padding: EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
color: Color(0xFFE9EEF4),
borderRadius: BorderRadius.all(Radius.circular(10))),
child: TextField(
keyboardAppearance: Brightness.light,
maxLines: 10,
focusNode: focusNode,
textInputAction: TextInputAction.done,
onSubmitted: (input) {
focusNode.unfocus();

},
decoration: new InputDecoration(
hintText: I18n.of(context).translation_more_desc,
hintStyle: TextStyle(fontSize: 14),
border: InputBorder.none,

),
// maxLines: 1,
inputFormatters: [LengthLimitingTextInputFormatter(160)],
inputFormatters: [LengthLimitingTextInputFormatter(80)],
// obscureText: true,
style: TextStyle(textBaseline: TextBaseline.alphabetic),
onChanged: (str) {
extraMsg = str;
setState(() {});
},
),
),
Text(
style: TextStyle(textBaseline: TextBaseline.alphabetic),
onChanged: (str) {
if (_scrollController != null) {
///解决键盘遮挡输入框
_scrollController.position.moveTo(
200,
duration: Duration(milliseconds: 100),
curve: Curves.easeIn,
);
}
extraMsg = str;
textLimitTips = I18n.of(context).translation_input_limit.replaceAll('/s1', (80-str.length).toString());
setState(() {});
},
),
),


Positioned.fill(child: Container(padding: EdgeInsets.only(bottom: 5,right: 5),alignment: Alignment.bottomRight,child: Text(
textLimitTips,
textScaleFactor: 1.0,
style: TextStyle(color: Color(0xFF95A3B2), fontSize: 11),
),)),
],),
Padding(padding: EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 8),child: Text(
I18n.of(context).translation_butler_scenes_tips,
textScaleFactor: 1.0,
style: TextStyle(color: Color(0xFFFA7B3D), fontSize: 12),
),
),),

],
),
@@ -593,7 +643,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
width: 190.0,
child: CircularProgressIndicator(
//0~1的浮点数,用来表示进度多少;如果 value 为 null 或空,则显示一个动画,否则显示一个定值
value: null,
value: time60/60,
strokeWidth: 5,
//背景颜色
backgroundColor: Color(0xffB2B2B2),
@@ -665,11 +715,16 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
int secondsPassed = 1;
int timeStamp;
Timer timer;
int time60=1;
void handleTick() {
// if (isActive) {
setState(() {
secondsPassed = secondsPassed + 1; //需要更新UI

time60=time60+1;
if(time60==60){
time60=0;
}
});
// }
}


+ 3
- 1
lib/home/realtimehelper/translation_evaluation_dialog.dart 查看文件

@@ -4,6 +4,8 @@ import 'package:chat/r.dart';
import 'package:chat/utils/screen.dart';
import 'package:flutter/material.dart';


///翻译管家-结束后评论弹窗
class TravelEvaluationPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
@@ -64,7 +66,7 @@ class TravelEvaluationPageState extends State<TravelEvaluationPage> {
width: Screen.width - 20,
margin: EdgeInsets.all(10),
child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25),


+ 2
- 2
lib/home/realtimehelper/travel_butler_page.dart 查看文件

@@ -68,7 +68,7 @@ class TravelButlerPageState extends State<TravelButlerPage> {
Container(
margin: EdgeInsets.all(10),
child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25),
@@ -189,7 +189,7 @@ class TravelButlerPageState extends State<TravelButlerPage> {
Container(
margin: EdgeInsets.all(10),
child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25),


+ 1
- 1
lib/home/unread_dot_widget.dart 查看文件

@@ -28,7 +28,7 @@ class _UnreadDotState extends State<UnreadDot> {
}
updateDotState(args) {
print('更新未读状态');
// print('更新未读状态');
Future.delayed(Duration(milliseconds: 100), () {
if (mounted) {
setState(() {});


+ 1
- 1
lib/utils/CustomUI.dart 查看文件

@@ -1262,7 +1262,7 @@ class CustomUI {
width: Screen.width-20,
margin: EdgeInsets.all(10),
child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25),


+ 1
- 1
lib/utils/group_info_table.dart 查看文件

@@ -203,7 +203,7 @@ class GroupInfoTableModel {
//修改是否在聊天中展示用户名称
updateShowNameSwitch(int sessionId, int isShow) {
print('修改是否在聊天中展示用户名称');
print('修改是否在聊天中展示用户名称:$isShow');
var curUserId = UserData().basicInfo.userId;


+ 1
- 1
lib/utils/local_notification_util.dart 查看文件

@@ -306,7 +306,7 @@ class LocalNotificationUtil {
Future<void> show(String title, String content,{int id}) async {
if (!isBackground || !UserData().privatyMsgPushSwitch) {
print('程序在前台,不发生推送通知 || 用户关闭推送');
// print('程序在前台,不发生推送通知 || 用户关闭推送');
return;
}
showNotification(title, content,id: id);


+ 13
- 3
lib/utils/msgHandler.dart 查看文件

@@ -236,6 +236,7 @@ class MsgHandler {
//获取会话未读消息
static getUnreadMsgDetail(bool isGroup) {
print('获取未读消息 群$isGroup');
// showToast('获取未读消息 群$isGroup');
var seq = RequestTargetUnreadReq.create();
seq.targetId = curActiveSession;
@@ -250,6 +251,7 @@ class MsgHandler {
NetWork().sendMsg(ComId.Chat, 5, seq);
}
static int tempGroupId=0;
static handlerReceiveMsg(PushChat chat) async {
bool isGroup = false;
if (chat.channelType == ChatChannelType.Group) {
@@ -426,6 +428,10 @@ class MsgHandler {
}
}
} else { //聊天消息
// receivedCount++;
int sessionId = chat.targetId;
print('sessionId $sessionId');
if (isGroup) {
@@ -436,7 +442,8 @@ class MsgHandler {
if (groupInfo != null) {
showGroup = groupInfo.messageFree == 0;
}
if (showGroup) {
if (showGroup && tempGroupId!=sessionId) {
tempGroupId = sessionId;
LocalNotificationUtil.instance.show(
I18n.of(context).notice, I18n.of(context).new_chat_msg,
id: sessionId > 1000
@@ -453,6 +460,9 @@ class MsgHandler {
chat.contentBuff, chat.sendTime.toInt(), chat.targetId,
channelType: chat.channelType.value);
String content =utf8.decode(msgModel.msgContent);
// print('当前收到消息条数$receivedCount $content');
if (chat.hasTencentTranslate()) {
msgModel.translateContent = chat.tencentTranslate;
}
@@ -511,7 +521,7 @@ class MsgHandler {
print('消息为空,无法保存');
return;
}
print('收到消息,准备保存 会话Id:${msgModel.sessionId}');
// print('收到消息,准备保存 会话Id:${msgModel.sessionId}');
ChatDataMgr().saveMsg(msgModel);
if (msgModel.msgType == ChatType.ShortVoiceChatType.value) {
//如果是语音消息,自动下载
@@ -807,7 +817,7 @@ class MsgHandler {
}
} else if (msgId == 3) {
var msgContent = PushChat.fromBuffer(content);
print('收到聊天消息');
// print('收到聊天消息');
ackServerMsg(msgContent.sendTime);
handlerReceiveMsg(msgContent);
} else if (msgId == 4) {


Loading…
取消
儲存