no message
This commit is contained in:
165
lib/src/models/channel_info.dart
Normal file
165
lib/src/models/channel_info.dart
Normal file
@@ -0,0 +1,165 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
/// Channel Information
|
||||
class ChannelInfo {
|
||||
/// Channel ID
|
||||
String channelID;
|
||||
|
||||
/// Channel Name
|
||||
String? channelName;
|
||||
|
||||
/// Channel Announcement
|
||||
String? notification;
|
||||
|
||||
/// Channel Introduction
|
||||
String? introduction;
|
||||
|
||||
/// Channel Avatar
|
||||
String? faceURL;
|
||||
|
||||
/// Creation Time
|
||||
int? createTime;
|
||||
|
||||
/// Number of Channel Members
|
||||
int? memberCount;
|
||||
|
||||
/// Channel Status: 0 - Normal, 1 - Blocked, 2 - Dissolved, 3 - Muted
|
||||
int? status;
|
||||
|
||||
/// Creator's ID
|
||||
String? creatorUserID;
|
||||
|
||||
/// Channel Type [ChannelType]
|
||||
int? channelType;
|
||||
|
||||
/// Extra Information
|
||||
String? ex;
|
||||
|
||||
|
||||
ChannelInfo({
|
||||
required this.channelID,
|
||||
this.channelName,
|
||||
this.notification,
|
||||
this.introduction,
|
||||
this.faceURL,
|
||||
this.createTime,
|
||||
this.memberCount,
|
||||
this.status,
|
||||
this.creatorUserID,
|
||||
this.channelType,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
ChannelInfo.fromJson(Map<String, dynamic> json) : channelID = json['channelID'] {
|
||||
channelName = json['channelName'];
|
||||
notification = json['notification'];
|
||||
introduction = json['introduction'];
|
||||
faceURL = json['faceURL'];
|
||||
createTime = json['createTime'];
|
||||
memberCount = json['memberCount'];
|
||||
status = json['status'];
|
||||
creatorUserID = json['creatorUserID'];
|
||||
channelType = json['channelType'];
|
||||
ex = json['ex'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['channelID'] = this.channelID;
|
||||
data['channelName'] = this.channelName;
|
||||
data['notification'] = this.notification;
|
||||
data['introduction'] = this.introduction;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['createTime'] = this.createTime;
|
||||
data['memberCount'] = this.memberCount;
|
||||
data['status'] = this.status;
|
||||
data['creatorUserID'] = this.creatorUserID;
|
||||
data['channelType'] = this.channelType;
|
||||
data['ex'] = this.ex;
|
||||
return data;
|
||||
}
|
||||
|
||||
/// Corresponding Conversation Type for Channel Type
|
||||
int get sessionType => ConversationType.superChannel;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) || other is ChannelInfo && runtimeType == other.runtimeType && channelID == other.channelID;
|
||||
|
||||
@override
|
||||
int get hashCode => channelID.hashCode;
|
||||
}
|
||||
|
||||
/// Channel Member Information
|
||||
class ChannelMembersInfo {
|
||||
/// Channel ID
|
||||
String? channelID;
|
||||
|
||||
/// User ID
|
||||
String? userID;
|
||||
|
||||
/// Nickname
|
||||
String? nickname;
|
||||
|
||||
/// Avatar
|
||||
String? faceURL;
|
||||
|
||||
/// Role [ChannelRoleLevel]
|
||||
int? roleLevel;
|
||||
|
||||
/// Join Time
|
||||
int? joinTime;
|
||||
|
||||
/// Extra Information
|
||||
String? ex;
|
||||
|
||||
/// Mute End Time (seconds)
|
||||
int? muteEndTime;
|
||||
|
||||
ChannelMembersInfo({
|
||||
this.channelID,
|
||||
this.userID,
|
||||
this.roleLevel,
|
||||
this.joinTime,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.ex,
|
||||
this.muteEndTime,
|
||||
});
|
||||
|
||||
ChannelMembersInfo.fromJson(Map<String, dynamic> json) {
|
||||
channelID = json['channelID'];
|
||||
userID = json['userID'];
|
||||
roleLevel = json['roleLevel'];
|
||||
joinTime = json['joinTime'];
|
||||
nickname = json['nickname'];
|
||||
faceURL = json['faceURL'];
|
||||
ex = json['ex'];
|
||||
muteEndTime = json['muteEndTime'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['channelID'] = this.channelID;
|
||||
data['userID'] = this.userID;
|
||||
data['roleLevel'] = this.roleLevel;
|
||||
data['joinTime'] = this.joinTime;
|
||||
data['nickname'] = this.nickname;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['ex'] = this.ex;
|
||||
data['muteEndTime'] = this.muteEndTime;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is ChannelMembersInfo &&
|
||||
runtimeType == other.runtimeType &&
|
||||
channelID == other.channelID &&
|
||||
userID == other.userID;
|
||||
|
||||
@override
|
||||
int get hashCode => channelID.hashCode ^ userID.hashCode;
|
||||
}
|
||||
@@ -15,6 +15,9 @@ class ConversationInfo {
|
||||
// Group ID in case of a group chat
|
||||
String? groupID;
|
||||
|
||||
// Channel ID in case of a channel chat
|
||||
String? channelID;
|
||||
|
||||
// Display name or nickname
|
||||
String? showName;
|
||||
|
||||
@@ -69,6 +72,7 @@ class ConversationInfo {
|
||||
this.conversationType,
|
||||
this.userID,
|
||||
this.groupID,
|
||||
this.channelID,
|
||||
this.showName,
|
||||
this.faceURL,
|
||||
this.recvMsgOpt,
|
||||
@@ -91,6 +95,7 @@ class ConversationInfo {
|
||||
conversationType = json['conversationType'];
|
||||
userID = json['userID'];
|
||||
groupID = json['groupID'];
|
||||
channelID = json['channelID'];
|
||||
showName = json['showName'];
|
||||
faceURL = json['faceURL'];
|
||||
recvMsgOpt = json['recvMsgOpt'];
|
||||
@@ -122,6 +127,7 @@ class ConversationInfo {
|
||||
data['conversationType'] = this.conversationType;
|
||||
data['userID'] = this.userID;
|
||||
data['groupID'] = this.groupID;
|
||||
data['channelID'] = this.channelID;
|
||||
data['showName'] = this.showName;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['recvMsgOpt'] = this.recvMsgOpt;
|
||||
@@ -147,6 +153,10 @@ class ConversationInfo {
|
||||
// Check if it's a group chat
|
||||
bool get isGroupChat => conversationType == ConversationType.group || conversationType == ConversationType.superGroup;
|
||||
|
||||
// Check if it's a channel chat
|
||||
bool get isChannelChat => conversationType == ConversationType.superChannel;
|
||||
|
||||
|
||||
// Check if it's a valid conversation (not in a group if isNotInGroup is true)
|
||||
bool get isValid => isSingleChat || (isGroupChat && !isNotInGroup!);
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ class Message {
|
||||
/// Group ID.
|
||||
String? groupID;
|
||||
|
||||
/// Channel ID.
|
||||
String? channelID;
|
||||
|
||||
/// Message localEx.
|
||||
String? localEx;
|
||||
|
||||
@@ -137,6 +140,7 @@ class Message {
|
||||
this.senderNickname,
|
||||
this.senderFaceUrl,
|
||||
this.groupID,
|
||||
this.channelID,
|
||||
this.localEx,
|
||||
this.seq,
|
||||
this.isRead,
|
||||
@@ -179,6 +183,7 @@ class Message {
|
||||
senderNickname = json['senderNickname'];
|
||||
senderFaceUrl = json['senderFaceUrl'];
|
||||
groupID = json['groupID'];
|
||||
channelID = json['channelID'];
|
||||
localEx = json['localEx'];
|
||||
seq = json['seq'];
|
||||
isRead = json['isRead'];
|
||||
@@ -224,6 +229,7 @@ class Message {
|
||||
data['senderNickname'] = this.senderNickname;
|
||||
data['senderFaceUrl'] = this.senderFaceUrl;
|
||||
data['groupID'] = this.groupID;
|
||||
data['channelID'] = this.channelID;
|
||||
data['localEx'] = this.localEx;
|
||||
data['seq'] = this.seq;
|
||||
data['isRead'] = this.isRead;
|
||||
@@ -275,6 +281,7 @@ class Message {
|
||||
senderNickname = message.senderNickname;
|
||||
senderFaceUrl = message.senderFaceUrl;
|
||||
groupID = message.groupID;
|
||||
channelID = message.channelID;
|
||||
// content = message.content;
|
||||
seq = message.seq;
|
||||
isRead = message.isRead;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import '../../flutter_openim_sdk.dart';
|
||||
import 'channel_info.dart';
|
||||
|
||||
/// OA notification
|
||||
class OANotification {
|
||||
@@ -454,3 +455,254 @@ class GroupMemberInfoChangedNotification {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///todo 所有的聊天的操作者都没有,暂时没有处理
|
||||
/// 聊天室事件通知
|
||||
class ChannelNotification {
|
||||
/// 聊天室信息
|
||||
ChannelInfo? Channel;
|
||||
|
||||
/// 当前事件操作者信息
|
||||
ChannelMembersInfo? opUser;
|
||||
|
||||
/// 聊天室拥有者信息
|
||||
ChannelMembersInfo? ChannelOwnerUser;
|
||||
|
||||
/// 产生影响的聊天室成员列表
|
||||
List<ChannelMembersInfo>? memberList;
|
||||
|
||||
ChannelNotification({
|
||||
this.Channel,
|
||||
this.opUser,
|
||||
this.ChannelOwnerUser,
|
||||
this.memberList,
|
||||
});
|
||||
|
||||
ChannelNotification.fromJson(Map<String, dynamic> json) {
|
||||
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
ChannelOwnerUser = json['channelOwnerUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['channelOwnerUser'])
|
||||
: null;
|
||||
if (json['memberList'] != null) {
|
||||
memberList = <ChannelMembersInfo>[];
|
||||
json['memberList'].forEach((v) {
|
||||
memberList!.add(ChannelMembersInfo.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.Channel != null) {
|
||||
data['channel'] = this.Channel!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.ChannelOwnerUser != null) {
|
||||
data['channelOwnerUser'] = this.ChannelOwnerUser!.toJson();
|
||||
}
|
||||
if (this.memberList != null) {
|
||||
data['memberList'] = this.memberList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 组踢出成员通知
|
||||
class KickedChannelMemeberNotification {
|
||||
/// 聊天室信息
|
||||
ChannelInfo? Channel;
|
||||
|
||||
/// 操作者信息
|
||||
ChannelMembersInfo? opUser;
|
||||
|
||||
/// 被踢出聊天室的成员信息列表
|
||||
List<ChannelMembersInfo>? kickedUserList;
|
||||
|
||||
KickedChannelMemeberNotification(
|
||||
{this.Channel, this.opUser, this.kickedUserList});
|
||||
|
||||
KickedChannelMemeberNotification.fromJson(Map<String, dynamic> json) {
|
||||
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
if (json['kickedUserList'] != null) {
|
||||
kickedUserList = <ChannelMembersInfo>[];
|
||||
json['kickedUserList'].forEach((v) {
|
||||
kickedUserList!.add(ChannelMembersInfo.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.Channel != null) {
|
||||
data['channel'] = this.Channel!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.kickedUserList != null) {
|
||||
data['kickedUserList'] =
|
||||
this.kickedUserList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 退出聊天室通知
|
||||
class QuitChannelNotification {
|
||||
/// 聊天室信息
|
||||
ChannelInfo? Channel;
|
||||
|
||||
/// 退聊天室的成员信息
|
||||
ChannelMembersInfo? quitUser;
|
||||
|
||||
QuitChannelNotification({this.Channel, this.quitUser});
|
||||
|
||||
QuitChannelNotification.fromJson(Map<String, dynamic> json) {
|
||||
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
|
||||
quitUser = json['quitUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['quitUser'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.Channel != null) {
|
||||
data['channel'] = this.Channel!.toJson();
|
||||
}
|
||||
if (this.quitUser != null) {
|
||||
data['quitUser'] = this.quitUser!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 进聊天室通知
|
||||
class EnterChannelNotification {
|
||||
/// 聊天室信息
|
||||
ChannelInfo? Channel;
|
||||
|
||||
/// 进入聊天室的成员信息
|
||||
ChannelMembersInfo? entrantUser;
|
||||
|
||||
EnterChannelNotification({this.Channel, this.entrantUser});
|
||||
|
||||
EnterChannelNotification.fromJson(Map<String, dynamic> json) {
|
||||
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
|
||||
entrantUser = json['entrantUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['entrantUser'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.Channel != null) {
|
||||
data['channel'] = this.Channel!.toJson();
|
||||
}
|
||||
if (this.entrantUser != null) {
|
||||
data['quitUser'] = this.entrantUser!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 禁言成员通知
|
||||
class MuteChannelMemberNotification {
|
||||
/// 聊天室信息
|
||||
ChannelInfo? Channel;
|
||||
|
||||
/// 操作者信息
|
||||
ChannelMembersInfo? opUser;
|
||||
|
||||
/// 被禁言的成员信息
|
||||
ChannelMembersInfo? mutedUser;
|
||||
|
||||
/// 禁言时间s
|
||||
int? mutedSeconds;
|
||||
|
||||
MuteChannelMemberNotification({
|
||||
this.Channel,
|
||||
this.opUser,
|
||||
this.mutedUser,
|
||||
this.mutedSeconds,
|
||||
});
|
||||
|
||||
MuteChannelMemberNotification.fromJson(Map<String, dynamic> json) {
|
||||
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
mutedUser = json['mutedUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['mutedUser'])
|
||||
: null;
|
||||
mutedSeconds = json['mutedSeconds'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.Channel != null) {
|
||||
data['channel'] = this.Channel!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.mutedUser != null) {
|
||||
data['mutedUser'] = this.mutedUser!.toJson();
|
||||
}
|
||||
data['mutedSeconds'] = this.mutedSeconds;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 聊天室成员信息发送变化通知
|
||||
class ChannelMemberInfoChangedNotification {
|
||||
/// 聊天室信息
|
||||
ChannelInfo? Channel;
|
||||
|
||||
/// 操作者信息
|
||||
ChannelMembersInfo? opUser;
|
||||
|
||||
/// 资料发生改变的成员
|
||||
ChannelMembersInfo? changedUser;
|
||||
|
||||
ChannelMemberInfoChangedNotification({
|
||||
this.Channel,
|
||||
this.opUser,
|
||||
this.changedUser,
|
||||
});
|
||||
|
||||
ChannelMemberInfoChangedNotification.fromJson(Map<String, dynamic> json) {
|
||||
Channel = json['channel'] != null ? ChannelInfo.fromJson(json['channel']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
changedUser = json['changedUser'] != null
|
||||
? ChannelMembersInfo.fromJson(json['changedUser'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.Channel != null) {
|
||||
data['Channel'] = this.Channel!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.changedUser != null) {
|
||||
data['changedUser'] = this.changedUser!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
41
lib/src/models/set_channel_member_info.dart
Normal file
41
lib/src/models/set_channel_member_info.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
class SetChannelMemberInfo {
|
||||
SetChannelMemberInfo({
|
||||
required this.channelID,
|
||||
required this.userID,
|
||||
this.roleLevel,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
final String channelID;
|
||||
final String userID;
|
||||
final int? roleLevel;
|
||||
final String? nickname;
|
||||
final String? faceURL;
|
||||
final String? ex;
|
||||
|
||||
SetChannelMemberInfo.fromJson(Map<String, dynamic> json)
|
||||
: channelID = json['channelID'],
|
||||
userID = json['userID'],
|
||||
roleLevel = json['roleLevel'],
|
||||
nickname = json['nickname'],
|
||||
faceURL = json['faceURL'],
|
||||
ex = json['ex'];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['channelID'] = channelID;
|
||||
data['userID'] = userID;
|
||||
data['roleLevel'] = roleLevel;
|
||||
data['nickname'] = nickname;
|
||||
data['faceURL'] = faceURL;
|
||||
data['ex'] = ex;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetChannelMemberInfo{channelID: $channelID, userID: $userID, roleLevel: $roleLevel, nickname: $nickname, faceURL: $faceURL, ex: $ex}';
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,8 @@ class ConversationReq {
|
||||
final bool? isMsgDestruct;
|
||||
final int? msgDestructTime;
|
||||
final int? groupAtType;
|
||||
final String? channelID;
|
||||
final int? channelAtType;
|
||||
|
||||
ConversationReq({
|
||||
this.userID,
|
||||
@@ -59,6 +61,8 @@ class ConversationReq {
|
||||
this.isMsgDestruct,
|
||||
this.msgDestructTime,
|
||||
this.groupAtType,
|
||||
this.channelID,
|
||||
this.channelAtType,
|
||||
});
|
||||
|
||||
ConversationReq.fromJson(Map<String, dynamic> json)
|
||||
@@ -71,8 +75,11 @@ class ConversationReq {
|
||||
burnDuration = json['burnDuration'],
|
||||
isMsgDestruct = json['isMsgDestruct'],
|
||||
msgDestructTime = json['msgDestructTime'],
|
||||
channelID=json['channelID'],
|
||||
channelAtType = json['channelAtType'],
|
||||
groupAtType = json['groupAtType'];
|
||||
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['userID'] = userID;
|
||||
@@ -85,7 +92,8 @@ class ConversationReq {
|
||||
data['isMsgDestruct'] = isMsgDestruct;
|
||||
data['msgDestructTime'] = msgDestructTime;
|
||||
data['groupAtType'] = groupAtType;
|
||||
|
||||
data['channelID'] = channelID;
|
||||
data['channelAtType'] = channelAtType;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user