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

@@ -175,4 +175,22 @@ public class ConversationManager extends BaseManager {
value(methodCall, "burnDuration") value(methodCall, "burnDuration")
); );
} }
public void setConversationIsMsgDestruct(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationIsMsgDestruct(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
value(methodCall, "isMsgDestruct")
);
}
public void setConversationMsgDestructTime(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationMsgDestructTime(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
int2long(methodCall, "duration")
);
}
} }

View File

@@ -1,17 +1,172 @@
/// 消息发送失败 // /// 消息发送失败
class MessageFailedCode { // class MessageFailedCode {
/// 被对方拉黑 // /// 被对方拉黑
static const int blockedByFriend = 1302; // static const int blockedByFriend = 1302;
//
// /// 被对方删除
// static const int deletedByFriend = 1303;
//
// /// 已被移除群聊/群已解散
// static const int notInGroup = 1204;
// }
//
// /// 添加好友失败
// class AddFriendFailedCode {
// /// 该用户已设置不可添加
// static const int refuseToAddFriends = 10013;
// }
/// 被对方删除 class SDKErrorCode {
static const int deletedByFriend = 601; /// 网络请求错误
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 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), "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 List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list
..sort((a, b) { ..sort((a, b) {

View File

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

View File

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

View File

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