Update error code

This commit is contained in:
hrxiang
2023-07-12 16:41:10 +08:00
parent 169da36d0b
commit 27eb0f78d2
6 changed files with 239 additions and 29 deletions

View File

@@ -1,17 +1,172 @@
/// 消息发送失败
class MessageFailedCode {
/// 被对方拉黑
static const int blockedByFriend = 1302;
// /// 消息发送失败
// class MessageFailedCode {
// /// 被对方拉黑
// static const int blockedByFriend = 1302;
//
// /// 被对方删除
// static const int deletedByFriend = 1303;
//
// /// 已被移除群聊/群已解散
// static const int notInGroup = 1204;
// }
//
// /// 添加好友失败
// class AddFriendFailedCode {
// /// 该用户已设置不可添加
// static const int refuseToAddFriends = 10013;
// }
/// 被对方删除
static const int deletedByFriend = 601;
class SDKErrorCode {
/// 网络请求错误
static const int networkRequestError = 10000;
/// 已被移除群聊/群已解散
static const int notInGroup = 1205;
}
/// 网络等待超时错误
static const int networkWaitTimeoutError = 10001;
/// 参数错误
static const int parameterError = 10002;
/// 上下文超时错误,通常为用户已经退出
static const int contextTimeoutError = 10003;
/// 资源未加载完毕,通常为未初始化,或者登录接口还未成功返回
static const int resourceNotLoaded = 10004;
/// 未知错误,需要根据 errmsg 确认原因
static const int unknownError = 10005;
/// sdk 内部错误,需要根据 errmsg 确认原因
static const int sdkInternalError = 10006;
/// 添加好友失败
class AddFriendFailedCode {
/// 该用户已设置不可添加
static const int refuseToAddFriends = 10013;
/// 用户不存在或未注册
static const int userNotExistOrNotRegistered = 10100;
/// 用户已经退出登录
static const int userHasLoggedOut = 10101;
/// 用户重复登录,可以通过 getloginstatus 确认登录状态,避免重复登录
static const int repeatLogin = 10102;
/// 需要上传的文件不存在
static const int uploadFileNotExist = 10200;
/// 消息解压失败
static const int messageDecompressionFailed = 10201;
/// 消息解码失败
static const int messageDecodingFailed = 10202;
/// 不支持的长连接二进制协议
static const int unsupportedLongConnection = 10203;
/// 消息重复发送
static const int messageRepeated = 10204;
/// 消息内容类型不支持
static const int messageContentTypeNotSupported = 10205;
/// 不支持的会话操作
static const int unsupportedSessionOperation = 10301;
/// 群 ID 不存在
static const int groupIDNotExist = 10400;
/// 群组类型错误
static const int wrongGroupType = 10401;
/// 服务器内部错误,通常为内部网络错误,需要检查服务器各节点运行是否正常
static const int serverInternalError = 500;
/// 参数错误,需要检查 body 参数以及 header 参数是否正确
static const int serverParameterError = 1001;
/// 权限不足,一般为 header 参数中携带 token 不正确,或者权限越级操作
static const int insufficientPermissions = 1002;
/// 数据库主键重复
static const int duplicateDatabasePrimaryKey = 1003;
/// 数据库记录未找到
static const int databaseRecordNotFound = 1004;
/// 用户 ID 不存在
static const int userIDNotExist = 1101;
/// 用户已经注册
static const int userAlreadyRegistered = 1102;
/// 群不存在
static const int groupNotExis = 1201;
/// 群已存在
static const int groupAlreadyExists = 1202;
/// 用户不在群组中
static const int userIsNotInGroup = 1203;
/// 群组已解散
static const int groupDisbanded = 1204;
/// 群申请已经被处理,不需要重复处理
static const int groupApplicationHasBeenProcessed = 1206;
/// 不能添加自己为好友
static const int notAddMyselfAsAFriend = 1301;
/// 已被对方拉黑
static const int hasBeenBlocked = 1302;
/// 对方不是自己的好友
static const int notFriend = 1303;
/// 已经是好友关系,不需要重复申请
static const int alreadyAFriendRelationship = 1304;
/// 消息已读功能被关闭
static const int messageReadFunctionIsTurnedOff = 1401;
/// 你已被禁言,不能在群里发言
static const int youHaveBeenBanned = 1402;
/// 群已被禁言,不能发言
static const int groupHasBeenBanned = 1403;
/// 该消息已被撤回
static const int messageHasBeenRetracted = 1404;
/// 授权过期
static const int licenseExpired = 1405;
/// token 已经过期
static const int tokenHasExpired = 1501;
/// token 无效
static const int tokenInvalid = 1502;
/// token 格式错误
static const int tokenFormatError = 1503;
/// token 还未生效
static const int tokenHasNotYetTakenEffect = 1504;
/// 未知 token 错误
static const int unknownTokenError = 1505;
/// 被踢出的 token无效
static const int thekickedOutTokenIsInvalid = 1506;
/// token 不存在
static const int tokenNotExist = 1507;
/// 连接数超过网关最大限制
static const int connectionsExceedsMaximumLimit = 1601;
/// 连接握手参数错误
static const int handshakeParameterError = 1602;
/// 文件上传过期
static const int fileUploadExpired = 1701;
}

View File

@@ -304,6 +304,36 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 开启定期删除
/// [isMsgDestruct] true 开启
Future<dynamic> setConversationIsMsgDestruct({
required String conversationID,
bool isMsgDestruct = true,
String? operationID,
}) =>
_channel.invokeMethod(
'setConversationIsMsgDestruct',
_buildParam({
"conversationID": conversationID,
"isMsgDestruct": isMsgDestruct,
"operationID": Utils.checkOperationID(operationID),
}));
/// 定期删除聊天记录
/// [duration] 秒
Future<dynamic> setConversationMsgDestructTime({
required String conversationID,
int duration = 1 * 24 * 60 * 60,
String? operationID,
}) =>
_channel.invokeMethod(
'setConversationMsgDestructTime',
_buildParam({
"conversationID": conversationID,
"duration": duration,
"operationID": Utils.checkOperationID(operationID),
}));
/// 会话列表自定义排序规则。
List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list
..sort((a, b) {

View File

@@ -51,8 +51,11 @@ class ConversationInfo {
/// 可阅读期限 s
int? burnDuration;
/// 附加内容
String? ext;
/// 是否开启定期销毁
bool? isMsgDestruct;
/// 定期销毁时间 s
int? msgDestructTime;
/// 附加内容
String? ex;
@@ -78,7 +81,9 @@ class ConversationInfo {
this.isPinned,
this.isNotInGroup,
this.ex,
this.ext,
this.groupAtType,
this.isMsgDestruct,
this.msgDestructTime,
});
ConversationInfo.fromJson(Map<String, dynamic> json)
@@ -106,7 +111,8 @@ class ConversationInfo {
isNotInGroup = json['isNotInGroup'];
groupAtType = json['groupAtType'];
ex = json['ex'];
ext = json['ext'];
isMsgDestruct = json['isMsgDestruct'];
msgDestructTime = json['msgDestructTime'];
}
Map<String, dynamic> toJson() {
@@ -129,7 +135,8 @@ class ConversationInfo {
data['isNotInGroup'] = this.isNotInGroup;
data['groupAtType'] = this.groupAtType;
data['ex'] = this.ex;
data['ext'] = this.ext;
data['isMsgDestruct'] = this.isMsgDestruct;
data['msgDestructTime'] = this.msgDestructTime;
return data;
}

View File

@@ -23,7 +23,7 @@ class MeetingInfoList {
}
class MeetingInfo {
String? meetingID;
String? roomID;
String? meetingName;
String? ex;
String? hostUserID;
@@ -46,7 +46,7 @@ class MeetingInfo {
List<String>? beWatchedUserIDList; // 正在被观看用户列表
MeetingInfo({
this.meetingID,
this.roomID,
this.meetingName,
this.ex,
this.hostUserID,
@@ -70,7 +70,7 @@ class MeetingInfo {
});
MeetingInfo.fromJson(Map<String, dynamic> json) {
meetingID = json['meetingID'];
roomID = json['roomID'];
meetingName = json['meetingName'];
ex = json['ex'];
hostUserID = json['hostUserID'];
@@ -107,7 +107,7 @@ class MeetingInfo {
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['meetingID'] = meetingID;
data['roomID'] = roomID;
data['meetingName'] = meetingName;
data['ex'] = ex;
data['hostUserID'] = hostUserID;
@@ -133,21 +133,21 @@ class MeetingInfo {
}
class MeetingStreamEvent {
String? meetingID;
String? roomID;
String? streamType;
bool? mute;
MeetingStreamEvent({this.meetingID, this.streamType, this.mute});
MeetingStreamEvent({this.roomID, this.streamType, this.mute});
MeetingStreamEvent.fromJson(Map<String, dynamic> json) {
meetingID = json['meetingID'];
roomID = json['roomID'];
streamType = json['streamType'];
mute = json['mute'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['meetingID'] = this.meetingID;
data['roomID'] = this.roomID;
data['streamType'] = this.streamType;
data['mute'] = this.mute;
return data;

View File

@@ -4,7 +4,7 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class SignalingInfo {
/// 操作者
String? opUserID;
String? userID;
/// 邀请信息
InvitationInfo? invitation;
@@ -13,24 +13,24 @@ class SignalingInfo {
OfflinePushInfo? offlinePushInfo;
SignalingInfo({
this.opUserID,
this.userID,
this.invitation,
this.offlinePushInfo,
});
SignalingInfo.fromJson(Map<String, dynamic> json) {
opUserID = json['opUserID'];
invitation = json['invitation'] == null
? null
: InvitationInfo.fromJson(json['invitation']);
offlinePushInfo = json['offlinePushInfo'] == null
? null
: OfflinePushInfo.fromJson(json['offlinePushInfo']);
userID = json['userID'] ?? invitation?.inviterUserID;
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['opUserID'] = this.opUserID;
data['userID'] = this.userID;
data['invitation'] = this.invitation?.toJson();
data['offlinePushInfo'] = this.offlinePushInfo?.toJson();
return data;
@@ -78,7 +78,7 @@ class InvitationInfo {
InvitationInfo.fromJson(Map<String, dynamic> json) {
inviterUserID = json['inviterUserID'];
inviteeUserIDList = json['inviteeUserIDList'].cast<String>();
inviteeUserIDList = json['inviteeUserIDList']?.cast<String>();
groupID = json['groupID'];
roomID = json['roomID'];
timeout = json['timeout'];