[Super Group]
This commit is contained in:
@@ -118,9 +118,16 @@ class ConversationInfo {
|
||||
return data;
|
||||
}
|
||||
|
||||
/// 是单聊
|
||||
bool get isSingleChat => conversationType == ConversationType.single;
|
||||
|
||||
bool get isGroupChat => conversationType == ConversationType.group;
|
||||
/// 是群聊
|
||||
bool get isGroupChat =>
|
||||
conversationType == ConversationType.group ||
|
||||
conversationType == ConversationType.superGroup;
|
||||
|
||||
/// 是有效的
|
||||
bool get isValid => isSingleChat || isGroupChat && !isNotInGroup!;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
|
||||
@@ -32,7 +32,7 @@ class GroupInfo {
|
||||
/// 创建者ID
|
||||
String? creatorUserID;
|
||||
|
||||
/// 群类型
|
||||
/// 群类型[GroupType]
|
||||
int? groupType;
|
||||
|
||||
/// 扩展字段
|
||||
@@ -41,6 +41,18 @@ class GroupInfo {
|
||||
/// 进群验证方式[GroupVerification]
|
||||
int? needVerification;
|
||||
|
||||
/// 不允许通过群获取成员资料 0:关闭,1:打开
|
||||
int? lookMemberInfo;
|
||||
|
||||
/// 不允许通过群添加好友 0:关闭,1:打开
|
||||
int? applyMemberFriend;
|
||||
|
||||
/// 通知更新时间
|
||||
int? notificationUpdateTime;
|
||||
|
||||
/// 通知发起人
|
||||
String? notificationUserID;
|
||||
|
||||
GroupInfo({
|
||||
required this.groupID,
|
||||
this.groupName,
|
||||
@@ -55,6 +67,10 @@ class GroupInfo {
|
||||
this.groupType,
|
||||
this.ex,
|
||||
this.needVerification,
|
||||
this.lookMemberInfo,
|
||||
this.applyMemberFriend,
|
||||
this.notificationUpdateTime,
|
||||
this.notificationUserID,
|
||||
});
|
||||
|
||||
GroupInfo.fromJson(Map<String, dynamic> json) : groupID = json['groupID'] {
|
||||
@@ -71,6 +87,10 @@ class GroupInfo {
|
||||
groupType = json['groupType'];
|
||||
ex = json['ex'];
|
||||
needVerification = json['needVerification'];
|
||||
lookMemberInfo = json['lookMemberInfo'];
|
||||
applyMemberFriend = json['applyMemberFriend'];
|
||||
notificationUpdateTime = json['notificationUpdateTime'];
|
||||
notificationUserID = json['notificationUserID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -88,8 +108,17 @@ class GroupInfo {
|
||||
data['groupType'] = this.groupType;
|
||||
data['ex'] = this.ex;
|
||||
data['needVerification'] = this.needVerification;
|
||||
data['lookMemberInfo'] = this.lookMemberInfo;
|
||||
data['applyMemberFriend'] = this.applyMemberFriend;
|
||||
data['notificationUpdateTime'] = this.notificationUpdateTime;
|
||||
data['notificationUserID'] = this.notificationUserID;
|
||||
return data;
|
||||
}
|
||||
|
||||
/// 群类型对应的会话类型
|
||||
int get sessionType => groupType == GroupType.general
|
||||
? ConversationType.group
|
||||
: ConversationType.superGroup;
|
||||
}
|
||||
|
||||
/// 群成员信息
|
||||
@@ -112,7 +141,7 @@ class GroupMembersInfo {
|
||||
/// 加入时间
|
||||
int? joinTime;
|
||||
|
||||
/// 入群方式
|
||||
/// 入群方式 2:邀请加入 3:搜索加入 4:通过二维码加入
|
||||
int? joinSource;
|
||||
|
||||
/// 操作者id
|
||||
@@ -123,8 +152,13 @@ class GroupMembersInfo {
|
||||
|
||||
/// 禁言时间s
|
||||
int? muteEndTime;
|
||||
|
||||
///
|
||||
int? appMangerLevel;
|
||||
|
||||
/// 邀请人id
|
||||
String? inviterUserID;
|
||||
|
||||
GroupMembersInfo({
|
||||
this.groupID,
|
||||
this.userID,
|
||||
@@ -137,6 +171,7 @@ class GroupMembersInfo {
|
||||
this.operatorUserID,
|
||||
this.muteEndTime,
|
||||
this.appMangerLevel,
|
||||
this.inviterUserID,
|
||||
});
|
||||
|
||||
GroupMembersInfo.fromJson(Map<String, dynamic> json) {
|
||||
@@ -151,6 +186,7 @@ class GroupMembersInfo {
|
||||
operatorUserID = json['operatorUserID'];
|
||||
muteEndTime = json['muteEndTime'];
|
||||
appMangerLevel = json['appMangerLevel'];
|
||||
inviterUserID = json['inviterUserID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -166,6 +202,7 @@ class GroupMembersInfo {
|
||||
data['operatorUserID'] = this.operatorUserID;
|
||||
data['muteEndTime'] = this.muteEndTime;
|
||||
data['appMangerLevel'] = this.appMangerLevel;
|
||||
data['inviterUserID'] = this.inviterUserID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,6 +287,14 @@ class Message {
|
||||
faceElem = message.faceElem;
|
||||
attachedInfoElem = message.attachedInfoElem;
|
||||
}
|
||||
|
||||
/// 单聊消息
|
||||
bool get isSingleChat => sessionType == ConversationType.single;
|
||||
|
||||
/// 群聊消息
|
||||
bool get isGroupChat =>
|
||||
sessionType == ConversationType.group ||
|
||||
sessionType == ConversationType.superGroup;
|
||||
}
|
||||
|
||||
/// 图片消息内容
|
||||
@@ -958,3 +966,71 @@ class AtUserInfo {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 消息撤回具体信息
|
||||
class RevokedInfo {
|
||||
/// 撤回者ID
|
||||
String? revokerID;
|
||||
|
||||
/// 撤回者群角色 [GroupRoleLevel]
|
||||
int? revokerRole;
|
||||
|
||||
/// 撤回者昵称
|
||||
String? revokerNickname;
|
||||
|
||||
/// 消息id
|
||||
String? clientMsgID;
|
||||
|
||||
/// 撤回时间
|
||||
int? revokeTime;
|
||||
|
||||
/// 消息发送时间
|
||||
int? sourceMessageSendTime;
|
||||
|
||||
/// 消息发送者
|
||||
String? sourceMessageSendID;
|
||||
|
||||
/// 消息发送者昵称
|
||||
String? sourceMessageSenderNickname;
|
||||
|
||||
/// 会话类型 [ConversationType]
|
||||
int? sessionType;
|
||||
|
||||
RevokedInfo({
|
||||
this.revokerID,
|
||||
this.revokerRole,
|
||||
this.revokerNickname,
|
||||
this.clientMsgID,
|
||||
this.revokeTime,
|
||||
this.sourceMessageSendTime,
|
||||
this.sourceMessageSendID,
|
||||
this.sourceMessageSenderNickname,
|
||||
this.sessionType,
|
||||
});
|
||||
|
||||
RevokedInfo.fromJson(Map<String, dynamic> json) {
|
||||
revokerID = json['revokerID'];
|
||||
revokerRole = json['revokerRole'];
|
||||
revokerNickname = json['revokerNickname'];
|
||||
clientMsgID = json['clientMsgID'];
|
||||
revokeTime = json['revokeTime'];
|
||||
sourceMessageSendTime = json['sourceMessageSendTime'];
|
||||
sourceMessageSendID = json['sourceMessageSendID'];
|
||||
sourceMessageSenderNickname = json['sourceMessageSenderNickname'];
|
||||
sessionType = json['sessionType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['revokerID'] = this.revokerID;
|
||||
data['revokerRole'] = this.revokerRole;
|
||||
data['revokerNickname'] = this.revokerNickname;
|
||||
data['clientMsgID'] = this.clientMsgID;
|
||||
data['revokeTime'] = this.revokeTime;
|
||||
data['sourceMessageSendTime'] = this.sourceMessageSendTime;
|
||||
data['sourceMessageSendID'] = this.sourceMessageSendID;
|
||||
data['sourceMessageSenderNickname'] = this.sourceMessageSenderNickname;
|
||||
data['sessionType'] = this.sessionType;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +322,13 @@ class FriendInfo {
|
||||
data['ex'] = this.ex;
|
||||
return data;
|
||||
}
|
||||
|
||||
String getShowName() => _isNull(remark) ?? _isNull(nickname) ?? userID!;
|
||||
|
||||
static String? _isNull(String? value) {
|
||||
if (value == null || value.trim().isEmpty) return null;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/// 黑名单信息
|
||||
|
||||
Reference in New Issue
Block a user