@@ -2306,6 +2306,35 @@ class _ProfilePageState extends State<ProfilePage> | |||
height: 137, | |||
child: Column( | |||
children: <Widget>[ | |||
InkWell( | |||
onTap: () async { | |||
Navigator.of(context).pop(); | |||
Navigator.of(context).push( | |||
new MaterialPageRoute( | |||
builder: (context) { | |||
return AddFriendPage( | |||
userId: userInfo.userId, | |||
pageType: | |||
SendMessagePageType.Remark, | |||
originalName: Provider.of< | |||
RefNameProvider>( | |||
context) | |||
.getRefName(userInfo.userId, | |||
userInfo.nickName)); | |||
}, | |||
), | |||
); | |||
}, | |||
child: Container( | |||
alignment: Alignment.center, | |||
height: 45, | |||
child: Text(I18n.of(context).Remark, | |||
textScaleFactor: 1.0, | |||
style: TextStyle( | |||
fontSize: 18, | |||
color: Constants | |||
.BlackTextColor)))), | |||
Divider(height: 1), | |||
InkWell( | |||
child: Container( | |||
height: 45, | |||
@@ -2355,35 +2384,8 @@ class _ProfilePageState extends State<ProfilePage> | |||
fontSize: 18, | |||
color: Constants | |||
.BlackTextColor)))), | |||
Divider(height: 1), | |||
InkWell( | |||
onTap: () async { | |||
Navigator.of(context).pop(); | |||
Navigator.of(context).push( | |||
new MaterialPageRoute( | |||
builder: (context) { | |||
return AddFriendPage( | |||
userId: userInfo.userId, | |||
pageType: | |||
SendMessagePageType.Remark, | |||
originalName: Provider.of< | |||
RefNameProvider>( | |||
context) | |||
.getRefName(userInfo.userId, | |||
userInfo.nickName)); | |||
}, | |||
), | |||
); | |||
}, | |||
child: Container( | |||
alignment: Alignment.center, | |||
height: 45, | |||
child: Text(I18n.of(context).Remark, | |||
textScaleFactor: 1.0, | |||
style: TextStyle( | |||
fontSize: 18, | |||
color: Constants | |||
.BlackTextColor)))), | |||
], | |||
), | |||
), | |||
@@ -42,10 +42,10 @@ BoxDecoration getCardDecoration() { | |||
class SystemEditPage extends StatefulWidget { | |||
SystemEditPage({Key key}) : super(key: key); | |||
_SystemEditPageState createState() => _SystemEditPageState(); | |||
SystemEditPageState createState() => SystemEditPageState(); | |||
} | |||
class _SystemEditPageState extends State<SystemEditPage> { | |||
class SystemEditPageState extends State<SystemEditPage> { | |||
static const Separate_Size = 15.0; | |||
String _selectType = UserData().language.toString(); | |||
bool soundPlayMode = false; | |||
@@ -510,12 +510,19 @@ class _SystemEditPageState extends State<SystemEditPage> { | |||
void _buildConfirmLogout() { | |||
CustomUI.buildOneConfirm( | |||
context, I18n.of(context).exit, I18n.of(context).determine, () { | |||
LocalNotificationUtil().removeAlias(); | |||
userLogout(); | |||
HttpUtil().postLoginOut(context); | |||
ReceiveShareFile.dispose(); | |||
}); | |||
} | |||
static userLogout(){ | |||
LocalNotificationUtil().removeAlias(); | |||
ReceiveShareFile.dispose(); | |||
} | |||
//退出登陆 | |||
Widget _buildLogout() { | |||
return Container( | |||
@@ -155,6 +155,7 @@ class GroupAllMemberState extends State<GroupAllMember> { | |||
width: size - 30, | |||
child: Text( | |||
refName, | |||
textAlign: TextAlign.center, | |||
style: TextStyle(fontSize: 11, color: Color(0xff818181)), | |||
maxLines: 1, | |||
overflow: TextOverflow.ellipsis, | |||
@@ -264,6 +264,7 @@ class GroupSettingState extends State<GroupSetting> { | |||
setState(() { | |||
showGroupFriendNickname = val; | |||
widget.groupInfoModel.updateShowNameSwitch(val); | |||
MsgHandler.setGroupIsShowMenberNiceNameReq(widget.groupInfoModel.sessionId, val); | |||
}); | |||
}), | |||
@@ -558,6 +559,7 @@ class GroupSettingState extends State<GroupSetting> { | |||
alignment: Alignment.center, | |||
child: Text( | |||
refName, | |||
textAlign: TextAlign.center, | |||
style: TextStyle(fontSize: 11, color: Color(0xff818181)), | |||
maxLines: 1, | |||
overflow: TextOverflow.ellipsis, | |||
@@ -2,6 +2,7 @@ import 'dart:async'; | |||
import 'package:chat/data/UserData.dart'; | |||
import 'package:chat/data/constants.dart'; | |||
import 'package:chat/generated/i18n.dart'; | |||
import 'package:chat/home/SystemEditPage.dart'; | |||
import 'package:chat/home/find_page.dart'; | |||
import 'package:chat/home/realtimehelper/real_time_helper_page.dart'; | |||
import 'package:chat/home/unread_dot_widget.dart'; | |||
@@ -300,6 +301,7 @@ class _HomeMainState extends State<HomeMain> { | |||
loginOut(args) { | |||
HttpUtil().postLoginOut(context); | |||
SystemEditPageState.userLogout(); | |||
showToast(I18n.of(context).otherLogin); | |||
} | |||
@@ -1194,6 +1194,7 @@ class GroupMember extends $pb.GeneratedMessage { | |||
..e<GroupMemberIdentity>(3, 'identity', $pb.PbFieldType.OE, GroupMemberIdentity.identityNormal, GroupMemberIdentity.valueOf, GroupMemberIdentity.values) | |||
..aOB(4, 'messageFree') | |||
..aOB(5, 'effectiveUser') | |||
..aOB(6, 'isShowMenberNiceName') | |||
..hasRequiredFields = false | |||
; | |||
@@ -1235,6 +1236,11 @@ class GroupMember extends $pb.GeneratedMessage { | |||
set effectiveUser($core.bool v) { $_setBool(4, v); } | |||
$core.bool hasEffectiveUser() => $_has(4); | |||
void clearEffectiveUser() => clearField(5); | |||
$core.bool get isShowMenberNiceName => $_get(5, false); | |||
set isShowMenberNiceName($core.bool v) { $_setBool(5, v); } | |||
$core.bool hasIsShowMenberNiceName() => $_has(5); | |||
void clearIsShowMenberNiceName() => clearField(6); | |||
} | |||
class GroupInfo extends $pb.GeneratedMessage { | |||
@@ -2203,3 +2209,73 @@ class SetGroupMasterMessageFreeRes extends $pb.GeneratedMessage { | |||
void clearMessageFree() => clearField(3); | |||
} | |||
class SetGroupIsShowMenberNiceNameReq extends $pb.GeneratedMessage { | |||
static final $pb.BuilderInfo _i = $pb.BuilderInfo('SetGroupIsShowMenberNiceNameReq', package: const $pb.PackageName('yl_pb')) | |||
..a<$core.int>(1, 'groupId', $pb.PbFieldType.OU3) | |||
..aOB(2, 'isShowMenberNiceName') | |||
..hasRequiredFields = false | |||
; | |||
SetGroupIsShowMenberNiceNameReq._() : super(); | |||
factory SetGroupIsShowMenberNiceNameReq() => create(); | |||
factory SetGroupIsShowMenberNiceNameReq.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); | |||
factory SetGroupIsShowMenberNiceNameReq.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); | |||
SetGroupIsShowMenberNiceNameReq clone() => SetGroupIsShowMenberNiceNameReq()..mergeFromMessage(this); | |||
SetGroupIsShowMenberNiceNameReq copyWith(void Function(SetGroupIsShowMenberNiceNameReq) updates) => super.copyWith((message) => updates(message as SetGroupIsShowMenberNiceNameReq)); | |||
$pb.BuilderInfo get info_ => _i; | |||
@$core.pragma('dart2js:noInline') | |||
static SetGroupIsShowMenberNiceNameReq create() => SetGroupIsShowMenberNiceNameReq._(); | |||
SetGroupIsShowMenberNiceNameReq createEmptyInstance() => create(); | |||
static $pb.PbList<SetGroupIsShowMenberNiceNameReq> createRepeated() => $pb.PbList<SetGroupIsShowMenberNiceNameReq>(); | |||
static SetGroupIsShowMenberNiceNameReq getDefault() => _defaultInstance ??= create()..freeze(); | |||
static SetGroupIsShowMenberNiceNameReq _defaultInstance; | |||
$core.int get groupId => $_get(0, 0); | |||
set groupId($core.int v) { $_setUnsignedInt32(0, v); } | |||
$core.bool hasGroupId() => $_has(0); | |||
void clearGroupId() => clearField(1); | |||
$core.bool get isShowMenberNiceName => $_get(1, false); | |||
set isShowMenberNiceName($core.bool v) { $_setBool(1, v); } | |||
$core.bool hasIsShowMenberNiceName() => $_has(1); | |||
void clearIsShowMenberNiceName() => clearField(2); | |||
} | |||
class SetGroupIsShowMenberNiceNameRes extends $pb.GeneratedMessage { | |||
static final $pb.BuilderInfo _i = $pb.BuilderInfo('SetGroupIsShowMenberNiceNameRes', package: const $pb.PackageName('yl_pb')) | |||
..a<$core.int>(1, 'errorCode', $pb.PbFieldType.O3) | |||
..a<$core.int>(2, 'groupId', $pb.PbFieldType.OU3) | |||
..aOB(3, 'isShowMenberNiceName') | |||
..hasRequiredFields = false | |||
; | |||
SetGroupIsShowMenberNiceNameRes._() : super(); | |||
factory SetGroupIsShowMenberNiceNameRes() => create(); | |||
factory SetGroupIsShowMenberNiceNameRes.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); | |||
factory SetGroupIsShowMenberNiceNameRes.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); | |||
SetGroupIsShowMenberNiceNameRes clone() => SetGroupIsShowMenberNiceNameRes()..mergeFromMessage(this); | |||
SetGroupIsShowMenberNiceNameRes copyWith(void Function(SetGroupIsShowMenberNiceNameRes) updates) => super.copyWith((message) => updates(message as SetGroupIsShowMenberNiceNameRes)); | |||
$pb.BuilderInfo get info_ => _i; | |||
@$core.pragma('dart2js:noInline') | |||
static SetGroupIsShowMenberNiceNameRes create() => SetGroupIsShowMenberNiceNameRes._(); | |||
SetGroupIsShowMenberNiceNameRes createEmptyInstance() => create(); | |||
static $pb.PbList<SetGroupIsShowMenberNiceNameRes> createRepeated() => $pb.PbList<SetGroupIsShowMenberNiceNameRes>(); | |||
static SetGroupIsShowMenberNiceNameRes getDefault() => _defaultInstance ??= create()..freeze(); | |||
static SetGroupIsShowMenberNiceNameRes _defaultInstance; | |||
$core.int get errorCode => $_get(0, 0); | |||
set errorCode($core.int v) { $_setSignedInt32(0, v); } | |||
$core.bool hasErrorCode() => $_has(0); | |||
void clearErrorCode() => clearField(1); | |||
$core.int get groupId => $_get(1, 0); | |||
set groupId($core.int v) { $_setUnsignedInt32(1, v); } | |||
$core.bool hasGroupId() => $_has(1); | |||
void clearGroupId() => clearField(2); | |||
$core.bool get isShowMenberNiceName => $_get(2, false); | |||
set isShowMenberNiceName($core.bool v) { $_setBool(2, v); } | |||
$core.bool hasIsShowMenberNiceName() => $_has(2); | |||
void clearIsShowMenberNiceName() => clearField(3); | |||
} | |||
@@ -372,6 +372,7 @@ const GroupMember$json = const { | |||
const {'1': 'Identity', '3': 3, '4': 1, '5': 14, '6': '.yl_pb.GroupMemberIdentity', '10': 'Identity'}, | |||
const {'1': 'MessageFree', '3': 4, '4': 1, '5': 8, '10': 'MessageFree'}, | |||
const {'1': 'EffectiveUser', '3': 5, '4': 1, '5': 8, '10': 'EffectiveUser'}, | |||
const {'1': 'IsShowMenberNiceName', '3': 6, '4': 1, '5': 8, '10': 'IsShowMenberNiceName'}, | |||
], | |||
}; | |||
@@ -618,3 +619,20 @@ const SetGroupMasterMessageFreeRes$json = const { | |||
], | |||
}; | |||
const SetGroupIsShowMenberNiceNameReq$json = const { | |||
'1': 'SetGroupIsShowMenberNiceNameReq', | |||
'2': const [ | |||
const {'1': 'GroupId', '3': 1, '4': 1, '5': 13, '10': 'GroupId'}, | |||
const {'1': 'IsShowMenberNiceName', '3': 2, '4': 1, '5': 8, '10': 'IsShowMenberNiceName'}, | |||
], | |||
}; | |||
const SetGroupIsShowMenberNiceNameRes$json = const { | |||
'1': 'SetGroupIsShowMenberNiceNameRes', | |||
'2': const [ | |||
const {'1': 'ErrorCode', '3': 1, '4': 1, '5': 5, '10': 'ErrorCode'}, | |||
const {'1': 'GroupId', '3': 2, '4': 1, '5': 13, '10': 'GroupId'}, | |||
const {'1': 'IsShowMenberNiceName', '3': 3, '4': 1, '5': 8, '10': 'IsShowMenberNiceName'}, | |||
], | |||
}; | |||
@@ -279,6 +279,7 @@ message GroupMember { | |||
optional GroupMemberIdentity Identity = 3; //成员身份 | |||
optional bool MessageFree = 4; //消息打扰标记 | |||
optional bool EffectiveUser = 5; //有效用户 移除群成员不直接删除数据而是修改有效标签 | |||
optional bool IsShowMenberNiceName =6; //是否显示成员昵称 | |||
} | |||
//群结构 | |||
message GroupInfo { | |||
@@ -463,4 +464,18 @@ message SetGroupMasterMessageFreeRes{ | |||
optional int32 ErrorCode = 1; //详见错误码文档 | |||
optional uint32 GroupId = 2; //群信息 | |||
optional bool MessageFree = 3; //消息免打扰 | |||
} | |||
//MsgId=229 消息免打扰 | |||
message SetGroupIsShowMenberNiceNameReq{ | |||
optional uint32 GroupId = 1; //群信息 | |||
optional bool IsShowMenberNiceName = 2; //消息免打扰 | |||
} | |||
//MsgId=230 消息免打扰 | |||
message SetGroupIsShowMenberNiceNameRes{ | |||
optional int32 ErrorCode = 1; //详见错误码文档 | |||
optional uint32 GroupId = 2; //群信息 | |||
optional bool IsShowMenberNiceName = 3; //消息免打扰 | |||
} |
@@ -251,7 +251,9 @@ class MsgHandler { | |||
NetWork().sendMsg(ComId.Chat, 5, seq); | |||
} | |||
// static int tempGroupId=0; | |||
static int tempGroupId=0; | |||
static int mLastClickTime = 0; | |||
static int timeInterval = 2500; | |||
// static int receivedCount=0; | |||
static handlerReceiveMsg(PushChat chat) async { | |||
bool isGroup = false; | |||
@@ -446,12 +448,21 @@ class MsgHandler { | |||
showGroup = groupInfo.messageFree == 0; | |||
} | |||
if (showGroup ) { | |||
// tempGroupId = sessionId; | |||
int nowTime = DateTime.now().millisecondsSinceEpoch; | |||
if (nowTime - mLastClickTime < timeInterval && tempGroupId==sessionId) { //2秒内同一群不重复弹出 | |||
return; | |||
} | |||
tempGroupId = sessionId; | |||
LocalNotificationUtil.instance.show( | |||
I18n.of(context).notice, I18n.of(context).new_chat_msg, | |||
id: sessionId > 1000 | |||
? int.parse(sessionId.toString().substring(0, 3)) | |||
: sessionId); | |||
mLastClickTime = nowTime; | |||
} | |||
}); | |||
} else { | |||
@@ -904,6 +915,8 @@ class MsgHandler { | |||
handlerAgreeMember(content); | |||
} else if (msgId == 228) { | |||
handlerUpdateMemberMsgFree(content); | |||
}else if (msgId == 230) { | |||
handlerGroupIsShowMenberNiceName(content); | |||
} | |||
break; | |||
case ComId.PushMsg: | |||
@@ -1181,6 +1194,45 @@ class MsgHandler { | |||
NetWork().sendMsg(ComId.Chat, 225, seq); | |||
} | |||
//是否显示群昵称 | |||
static setGroupIsShowMenberNiceNameReq(int groupId, bool isShow) { | |||
print('设置是否显示群昵称 groupId:$groupId isShow: $isShow'); | |||
var seq = SetGroupIsShowMenberNiceNameReq.create(); | |||
seq.groupId = groupId; | |||
seq.isShowMenberNiceName=isShow; | |||
NetWork().sendMsg(ComId.Chat, 229, seq); | |||
} | |||
//消息免打扰请求结果 | |||
static handlerGroupIsShowMenberNiceName(List<int> msgContent) { | |||
print('设置是否显示群昵称'); | |||
var res = SetGroupIsShowMenberNiceNameRes.fromBuffer(msgContent); | |||
if (res.errorCode == 0) { | |||
// GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); | |||
print('设置是否显示群昵称成功'); | |||
} else { | |||
print('消息免打扰请求结果失败${res.errorCode}'); | |||
} | |||
} | |||
//消息免打扰请求结果 | |||
static handlerUpdateMemberMsgFree(List<int> msgContent) { | |||
print('消息免打扰请求结果'); | |||
var res = SetGroupMasterMessageFreeRes.fromBuffer(msgContent); | |||
if (res.errorCode == 0) { | |||
GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); | |||
print('消息免打扰请求结果成功'); | |||
} else { | |||
print('消息免打扰请求结果失败${res.errorCode}'); | |||
} | |||
} | |||
//群主批准其他人加入群结果 | |||
static handlerAgreeMember(List<int> msgContent) { | |||
print('群主批准其他人加入群结果'); | |||
@@ -1207,17 +1259,7 @@ class MsgHandler { | |||
NetWork().sendMsg(ComId.Chat, 227, seq); | |||
} | |||
//消息免打扰请求结果 | |||
static handlerUpdateMemberMsgFree(List<int> msgContent) { | |||
print('消息免打扰请求结果'); | |||
var res = SetGroupMasterMessageFreeRes.fromBuffer(msgContent); | |||
if (res.errorCode == 0) { | |||
GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); | |||
print('消息免打扰请求结果成功'); | |||
} else { | |||
print('消息免打扰请求结果失败${res.errorCode}'); | |||
} | |||
} | |||
//请求群列表求结果 | |||
static handlerGetGroupListRes(List<int> msgContent) async { | |||
@@ -20,6 +20,7 @@ class ReceiveShareFile { | |||
if (nowTime - mLastClickTime > timeInterval) { | |||
if (value != null && value.length > 0) { | |||
MessageMgr().emit(MessageMgr.RECEIVE_THIRD_SHARE, value[0].path); | |||
mLastClickTime = nowTime; | |||
} | |||
} | |||
} else { | |||
@@ -39,7 +39,7 @@ dependencies: | |||
#压缩 | |||
# flutter_image_compress: ^0.6.3 | |||
flutter_native_image: ^0.0.5 | |||
flutter_native_image: ^0.0.5 #https://github.com/btastic/flutter_native_image | |||
#视频封面 | |||
video_thumbnail: ^0.1.6 | |||