From 6ad47216fb34471b4472b154d70794abb9a3a26e Mon Sep 17 00:00:00 2001 From: hrxiang Date: Mon, 27 Jun 2022 17:55:18 +0800 Subject: [PATCH] update --- CHANGELOG.md | 4 + lib/flutter_openim_sdk.dart | 1 + lib/src/enum/conversation_type.dart | 6 + lib/src/enum/group_at_type.dart | 10 + lib/src/enum/group_role_level.dart | 8 +- lib/src/enum/group_verification.dart | 11 + lib/src/enum/im_platform.dart | 3 + lib/src/enum/message_status.dart | 8 + lib/src/enum/message_type.dart | 88 ++++++- lib/src/listener/advanced_msg_listener.dart | 11 +- lib/src/listener/connect_listener.dart | 17 +- lib/src/listener/conversation_listener.dart | 4 + lib/src/listener/friendship_listener.dart | 10 + lib/src/listener/group_listener.dart | 11 + .../listener/msg_send_progress_listener.dart | 1 + lib/src/listener/organization_listener.dart | 1 + lib/src/listener/user_listener.dart | 1 + lib/src/listener/workmoments_listener.dart | 1 + lib/src/manager/im_conversation_manager.dart | 65 ++---- lib/src/manager/im_friendship_manager.dart | 33 +-- lib/src/manager/im_group_manager.dart | 57 +++-- lib/src/manager/im_manager.dart | 24 +- lib/src/manager/im_message_manager.dart | 99 ++++---- lib/src/manager/im_organization_manager.dart | 30 ++- lib/src/manager/im_signaling_manager.dart | 6 + lib/src/manager/im_user_manager.dart | 13 +- lib/src/manager/im_workmoments_manager.dart | 10 +- lib/src/models/conversation_info.dart | 33 ++- lib/src/models/group_info.dart | 110 ++++++++- lib/src/models/message.dart | 217 +++++++++++++++++- lib/src/models/notification_info.dart | 82 +++++-- lib/src/models/organization_info.dart | 70 ++++++ lib/src/models/search_info.dart | 6 + lib/src/models/signaling_info.dart | 46 +++- lib/src/models/user_info.dart | 120 +++++++++- lib/src/openim.dart | 7 +- pubspec.yaml | 2 +- 37 files changed, 970 insertions(+), 256 deletions(-) create mode 100644 lib/src/enum/group_verification.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 91e4573..5857959 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.0+1 + +1.Add join group verification set
+ ## 2.1.0 1.Fix bug
diff --git a/lib/flutter_openim_sdk.dart b/lib/flutter_openim_sdk.dart index 756a894..bb92a45 100644 --- a/lib/flutter_openim_sdk.dart +++ b/lib/flutter_openim_sdk.dart @@ -3,6 +3,7 @@ library flutter_openim_sdk; export 'src/enum/conversation_type.dart'; export 'src/enum/group_at_type.dart'; export 'src/enum/group_role_level.dart'; +export 'src/enum/group_verification.dart'; export 'src/enum/im_platform.dart'; export 'src/enum/listener_type.dart'; export 'src/enum/message_status.dart'; diff --git a/lib/src/enum/conversation_type.dart b/lib/src/enum/conversation_type.dart index 887d736..8d9091c 100644 --- a/lib/src/enum/conversation_type.dart +++ b/lib/src/enum/conversation_type.dart @@ -1,5 +1,11 @@ +/// 会话类型 class ConversationType { + /// 单聊 static const single = 1; + + /// 群聊 static const group = 2; + + /// 通知 static const notification = 4; } diff --git a/lib/src/enum/group_at_type.dart b/lib/src/enum/group_at_type.dart index 536183a..820a760 100644 --- a/lib/src/enum/group_at_type.dart +++ b/lib/src/enum/group_at_type.dart @@ -1,7 +1,17 @@ +/// 会话强提示内容 class GroupAtType { + /// 无提示 static const atNormal = 0; + + /// @了我提示 static const atMe = 1; + + /// @了所有人提示 static const atAll = 2; + + /// @了所有人@了我 static const atAllAtMe = 3; + + /// 群公告提示 static const groupNotification = 4; } diff --git a/lib/src/enum/group_role_level.dart b/lib/src/enum/group_role_level.dart index 731bd1f..27bd8cd 100644 --- a/lib/src/enum/group_role_level.dart +++ b/lib/src/enum/group_role_level.dart @@ -1,7 +1,11 @@ -/// 1 ordinary member, 2 group owners, 3 administrators -/// 1普通成员, 2群主,3管理员 +/// 群成员角色 class GroupRoleLevel { + /// 普通成员 static const member = 1; + + /// 群主 static const owner = 2; + + /// 管理员 static const admin = 3; } diff --git a/lib/src/enum/group_verification.dart b/lib/src/enum/group_verification.dart new file mode 100644 index 0000000..b00e468 --- /dev/null +++ b/lib/src/enum/group_verification.dart @@ -0,0 +1,11 @@ +/// 进群验证设置选项 +class GroupVerification { + /// 申请需要同意 邀请直接进 + static const int applyNeedVerificationInviteDirectly = 0; + + /// 所有人进群需要验证,除了群主管理员邀 + static const int allNeedVerification = 1; + + /// 直接进群 + static const int directly = 2; +} diff --git a/lib/src/enum/im_platform.dart b/lib/src/enum/im_platform.dart index 783b2b4..1532d3b 100644 --- a/lib/src/enum/im_platform.dart +++ b/lib/src/enum/im_platform.dart @@ -1,5 +1,8 @@ class IMPlatform { + /// IOS static const ios = 1; + + /// Android static const android = 2; static const windows = 3; static const xos = 4; diff --git a/lib/src/enum/message_status.dart b/lib/src/enum/message_status.dart index 969b21f..4d3ca8a 100644 --- a/lib/src/enum/message_status.dart +++ b/lib/src/enum/message_status.dart @@ -1,6 +1,14 @@ +/// 消息发送状态 class MessageStatus { + /// 发送中 static const sending = 1; + + /// 已发送成功 static const succeeded = 2; + + /// 发送失败 static const failed = 3; + + /// 已经删除 static const deleted = 4; } diff --git a/lib/src/enum/message_type.dart b/lib/src/enum/message_type.dart index e354a28..c9a1b40 100644 --- a/lib/src/enum/message_type.dart +++ b/lib/src/enum/message_type.dart @@ -1,67 +1,151 @@ +/// 消息类型 class MessageType { - /// + /// 普通文本 static const text = 101; + + /// 图片 static const picture = 102; + + /// 语音 static const voice = 103; + + /// 视频 static const video = 104; + + /// 文件 static const file = 105; + + /// @消息 static const at_text = 106; + + /// 合并 static const merger = 107; + + /// 名片 static const card = 108; + + /// 位置 static const location = 109; + + /// 自定义 static const custom = 110; + + /// 撤回 static const revoke = 111; + + /// 已读回执 static const has_read_receipt = 112; + + /// 正字输入 static const typing = 113; + + /// 引用回复 static const quote = 114; + + /// 自定义表情 static const custom_face = 115; - /// + /// 通知类型 static const notificationBegin = 1000; static const friendNotificationBegin = 1200; + + /// 好友申请已接受 static const friendApplicationApprovedNotification = 1201; + + /// 好友申请已拒绝 static const friendApplicationRejectedNotification = 1202; + + /// 好友申请 static const friendApplicationNotification = 1203; + + /// 好友已添加 static const friendAddedNotification = 1204; + + /// 好友已删除 static const friendDeletedNotification = 1205; + + /// 设置好友备注 static const friendRemarkSetNotification = 1206; + + /// 好友加入黑名单 static const blackAddedNotification = 1207; + + /// 已从黑名单移除 static const blackDeletedNotification = 1208; + static const friendNotificationEnd = 1299; + /// 会话改变 static const conversationChangeNotification = 1300; static const userNotificationBegin = 1301; + + /// 用户信息改变 static const userInfoUpdatedNotification = 1303; static const userNotificationEnd = 1399; + /// OA通知 static const oaNotification = 1400; static const groupNotificationBegin = 1500; + + /// 群已被创建 static const groupCreatedNotification = 1501; + + /// 群资料改变 static const groupInfoSetNotification = 1502; + + /// 进群申请 static const joinGroupApplicationNotification = 1503; + + /// 群成员退出 static const memberQuitNotification = 1504; + + /// 群申请被接受 static const groupApplicationAcceptedNotification = 1505; + + /// 群申请被拒绝 static const groupApplicationRejectedNotification = 1506; + + /// 群拥有者权限转移 static const groupOwnerTransferredNotification = 1507; + + /// 群成员被踢出群 static const memberKickedNotification = 1508; + + /// 邀请进群 static const memberInvitedNotification = 1509; + + /// 群成员进群 static const memberEnterNotification = 1510; + + /// 解散群 static const dismissGroupNotification = 1511; static const groupNotificationEnd = 1599; + /// 群成员被禁言 static const groupMemberMutedNotification = 1512; + + /// 群成员被取消禁言 static const groupMemberCancelMutedNotification = 1513; + + /// 群禁言 static const groupMutedNotification = 1514; + + /// 取消群禁言 static const groupCancelMutedNotification = 1515; + + /// 群成员信息改变 static const groupMemberInfoChangedNotification = 1516; static const signalingNotificationBegin = 1600; + + /// 信令 static const signalingNotification = 1601; static const signalingNotificationEnd = 1699; + /// 阅后即焚 static const burnAfterReadingNotification = 1701; static const notificationEnd = 2000; diff --git a/lib/src/listener/advanced_msg_listener.dart b/lib/src/listener/advanced_msg_listener.dart index f0d7daa..89ced39 100644 --- a/lib/src/listener/advanced_msg_listener.dart +++ b/lib/src/listener/advanced_msg_listener.dart @@ -1,15 +1,10 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; +/// 消息监听 class OnAdvancedMsgListener { - /// Message read receipt Function(List list)? onRecvC2CMessageReadReceipt; - Function(List list)? onRecvGroupMessageReadReceipt; - - /// A friend revoked a message Function(String msgId)? onRecvMessageRevoked; - - /// Receive new message Function(Message msg)? onRecvNewMessage; /// Uniquely identifies @@ -22,18 +17,22 @@ class OnAdvancedMsgListener { this.onRecvNewMessage, }) : id = "id_${DateTime.now().microsecondsSinceEpoch}"; + /// C2C消息已读回执 void recvC2CMessageReadReceipt(List list) { onRecvC2CMessageReadReceipt?.call(list); } + /// 群消息已读回执 void recvGroupMessageReadReceipt(List list) { onRecvGroupMessageReadReceipt?.call(list); } + /// 消息被撤回 void recvMessageRevoked(String msgId) { onRecvMessageRevoked?.call(msgId); } + /// 收到了一条新消息 void recvNewMessage(Message msg) { onRecvNewMessage?.call(msg); } diff --git a/lib/src/listener/connect_listener.dart b/lib/src/listener/connect_listener.dart index b2fe8fc..9d72004 100644 --- a/lib/src/listener/connect_listener.dart +++ b/lib/src/listener/connect_listener.dart @@ -1,19 +1,9 @@ +/// SDK 连接状态监听 class OnConnectListener { - /// SDK failed to connect to the server Function(int? code, String? errorMsg)? onConnectFailed; - - /// SDK has successfully connected to the server Function()? onConnectSuccess; - - /// SDK is connecting to the server Function()? onConnecting; - - /// The current user is kicked offline. - /// At this time, the UI can prompt the user and call IMManager's login() function to log in again. Function()? onKickedOffline; - - /// Ticket expired when online. - /// At this time, you need to generate a new userSig and call IMManager's login() function to log in again Function()? onUserSigExpired; OnConnectListener({ @@ -24,22 +14,27 @@ class OnConnectListener { this.onUserSigExpired, }); + /// SDK连接服务器失败 void connectFailed(int? code, String? errorMsg) { if (null != onConnectFailed) onConnectFailed!(code, errorMsg); } + /// SDK连接服务器成功 void connectSuccess() { if (null != onConnectSuccess) onConnectSuccess!(); } + /// SDK正在连接服务器 void connecting() { if (null != onConnecting) onConnecting!.call(); } + /// 账号已在其他地方登录,当前设备被踢下线 void kickedOffline() { if (null != onKickedOffline) onKickedOffline!(); } + /// 登录凭证过期,需要重新登录 void userSigExpired() { if (null != onUserSigExpired) onUserSigExpired!(); } diff --git a/lib/src/listener/conversation_listener.dart b/lib/src/listener/conversation_listener.dart index 8f278d3..bb3a09f 100644 --- a/lib/src/listener/conversation_listener.dart +++ b/lib/src/listener/conversation_listener.dart @@ -1,5 +1,6 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; +/// 会话监听 class OnConversationListener { Function(List list)? onConversationChanged; Function(List list)? onNewConversation; @@ -17,10 +18,12 @@ class OnConversationListener { this.onSyncServerStart, }); + /// 会话发送改变 void conversationChanged(List list) { if (onConversationChanged != null) onConversationChanged!(list); } + /// 有新会话产生 void newConversation(List list) { if (onNewConversation != null) onNewConversation!(list); } @@ -37,6 +40,7 @@ class OnConversationListener { if (onSyncServerStart != null) onSyncServerStart!(); } + /// 未读消息总数发送改变 void totalUnreadMessageCountChanged(int i) { if (onTotalUnreadMessageCountChanged != null) onTotalUnreadMessageCountChanged!(i); diff --git a/lib/src/listener/friendship_listener.dart b/lib/src/listener/friendship_listener.dart index bdd8ca4..7f8701f 100644 --- a/lib/src/listener/friendship_listener.dart +++ b/lib/src/listener/friendship_listener.dart @@ -1,5 +1,6 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; +/// 好友关系监听 class OnFriendshipListener { Function(FriendApplicationInfo i)? onFriendApplicationAdded; Function(FriendApplicationInfo i)? onFriendApplicationDeleted; @@ -23,38 +24,47 @@ class OnFriendshipListener { this.onFriendInfoChanged, }); + /// 已被加入黑名单 void blacklistAdded(BlacklistInfo u) { onBlacklistAdded?.call(u); } + /// 已从黑名单移除 void blacklistDeleted(BlacklistInfo u) { onBlacklistDeleted?.call(u); } + /// 好友已添加 void friendAdded(FriendInfo u) { onFriendAdded?.call(u); } + /// 好友申请已被接受 void friendApplicationAccepted(FriendApplicationInfo u) { onFriendApplicationAccepted?.call(u); } + /// 已添加新的好友申请 void friendApplicationAdded(FriendApplicationInfo u) { onFriendApplicationAdded?.call(u); } + /// 好友申请已被删除 void friendApplicationDeleted(FriendApplicationInfo u) { onFriendApplicationDeleted?.call(u); } + /// 好友申请已被拒绝 void friendApplicationRejected(FriendApplicationInfo u) { onFriendApplicationRejected?.call(u); } + /// 好友已被删除 void friendDeleted(FriendInfo u) { onFriendDeleted?.call(u); } + /// 好友资料发生改变 void friendInfoChanged(FriendInfo u) { onFriendInfoChanged?.call(u); } diff --git a/lib/src/listener/group_listener.dart b/lib/src/listener/group_listener.dart index bab46a3..15e0d96 100644 --- a/lib/src/listener/group_listener.dart +++ b/lib/src/listener/group_listener.dart @@ -1,5 +1,6 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; +/// 群组监听 class OnGroupListener { Function(GroupApplicationInfo info)? onGroupApplicationAccepted; Function(GroupApplicationInfo info)? onGroupApplicationAdded; @@ -25,42 +26,52 @@ class OnGroupListener { this.onJoinedGroupDeleted, }); + /// 群申请已被接受 void groupApplicationAccepted(GroupApplicationInfo info) { onGroupApplicationAccepted?.call(info); } + /// 群申请已被添加 void groupApplicationAdded(GroupApplicationInfo info) { onGroupApplicationAdded?.call(info); } + /// 群申请已被删除 void groupApplicationDeleted(GroupApplicationInfo info) { onGroupApplicationDeleted?.call(info); } + /// 群申请已被拒绝 void groupApplicationRejected(GroupApplicationInfo info) { onGroupApplicationRejected?.call(info); } + /// 群资料发生改变 void groupInfoChanged(GroupInfo info) { onGroupInfoChanged?.call(info); } + /// 群成员已添加 void groupMemberAdded(GroupMembersInfo info) { onGroupMemberAdded?.call(info); } + /// 群成员已删除 void groupMemberDeleted(GroupMembersInfo info) { onGroupMemberDeleted?.call(info); } + /// 群成员信息发送改变 void groupMemberInfoChanged(GroupMembersInfo info) { onGroupMemberInfoChanged?.call(info); } + /// 已加入的群有新增 void joinedGroupAdded(GroupInfo info) { onJoinedGroupAdded?.call(info); } + /// 已加入的群减少 void joinedGroupDeleted(GroupInfo info) { onJoinedGroupDeleted?.call(info); } diff --git a/lib/src/listener/msg_send_progress_listener.dart b/lib/src/listener/msg_send_progress_listener.dart index 3dfdf3c..490d559 100644 --- a/lib/src/listener/msg_send_progress_listener.dart +++ b/lib/src/listener/msg_send_progress_listener.dart @@ -1,3 +1,4 @@ +/// 消息发送进度监听 class OnMsgSendProgressListener { Function(String clientMsgID, int progress)? onProgress; diff --git a/lib/src/listener/organization_listener.dart b/lib/src/listener/organization_listener.dart index 000bcd8..8c109c3 100644 --- a/lib/src/listener/organization_listener.dart +++ b/lib/src/listener/organization_listener.dart @@ -3,6 +3,7 @@ class OnOrganizationListener { OnOrganizationListener({this.onOrganizationUpdated}); + /// 组织架构有更新 void organizationUpdated() { onOrganizationUpdated?.call(); } diff --git a/lib/src/listener/user_listener.dart b/lib/src/listener/user_listener.dart index 557f7b9..d6aac00 100644 --- a/lib/src/listener/user_listener.dart +++ b/lib/src/listener/user_listener.dart @@ -6,6 +6,7 @@ class OnUserListener { OnUserListener({this.onSelfInfoUpdated}); + /// 自身信息发送变化 void selfInfoUpdated(UserInfo info) { onSelfInfoUpdated?.call(info); } diff --git a/lib/src/listener/workmoments_listener.dart b/lib/src/listener/workmoments_listener.dart index f420fa8..4f720b7 100644 --- a/lib/src/listener/workmoments_listener.dart +++ b/lib/src/listener/workmoments_listener.dart @@ -3,6 +3,7 @@ class OnWorkMomentsListener { OnWorkMomentsListener({this.onRecvNewNotification}); + /// 朋友圈信息发送改变 void recvNewNotification() { onRecvNewNotification?.call(); } diff --git a/lib/src/manager/im_conversation_manager.dart b/lib/src/manager/im_conversation_manager.dart index e01d717..5285eb9 100644 --- a/lib/src/manager/im_conversation_manager.dart +++ b/lib/src/manager/im_conversation_manager.dart @@ -7,14 +7,12 @@ class ConversationManager { ConversationManager(this._channel); - /// Observe conversation changes /// 会话监听 Future setConversationListener(OnConversationListener listener) { this.listener = listener; return _channel.invokeMethod('setConversationListener', _buildParam({})); } - /// Get all conversations /// 获取所有会话 Future> getAllConversationList( {String? operationID}) => @@ -27,8 +25,9 @@ class ConversationManager { .then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map))); - /// Paging to get conversation /// 分页获取会话 + /// [offset] 开始下标 + /// [count] 每页数量 Future> getConversationListSplit({ int offset = 0, int count = 20, @@ -45,12 +44,9 @@ class ConversationManager { .then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map))); - /// Get a conversation, if it doesn't exist it will be created automatically - /// [sourceID] if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID - /// [sessionType] if it is a single chat, it value is 1. if it is a group chat, it value is 2 - /// 获取一个会话,如果不存在会自动创建 - /// [sourceID] 如果是单聊值传用户ID,如果是群聊值传组ID - /// [sessionType] 如果是单聊值传1,如果是群聊值传2 + /// 查询会话,如果会话不存在会自动生成一个 + /// [sourceID] 如果是单聊会话传userID,如果是群聊会话传GroupID + /// [sessionType] 如果是单聊会话传1,如果是群聊会话传2 Future getOneConversation({ required String sourceID, required int sessionType, @@ -67,8 +63,8 @@ class ConversationManager { .then((value) => Utils.toObj(value, (map) => ConversationInfo.fromJson(map))); - /// Get conversation list by id list - /// 获取多个会话 + /// 根据会话id获取多个会话 + /// [conversationIDList] 会话id列表 Future> getMultipleConversation({ required List conversationIDList, String? operationID, @@ -83,8 +79,8 @@ class ConversationManager { .then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map))); - /// Delete conversation by id - /// 删除会话 + /// 通过会话id删除指定会话 + /// [conversationID] 被删除的会话的id Future deleteConversation({ required String conversationID, String? operationID, @@ -96,8 +92,9 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Set draft /// 设置会话草稿 + /// [conversationID] 会话id + /// [draftText] 草稿 Future setConversationDraft({ required String conversationID, required String draftText, @@ -111,8 +108,9 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Pinned conversation /// 置顶会话 + /// [conversationID] 会话id + /// [isPinned] true:置顶,false:取消置顶 Future pinConversation({ required String conversationID, required bool isPinned, @@ -126,12 +124,8 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - // Future markSingleMessageHasRead({required String userID}) => - // _channel.invokeMethod( - // 'markSingleMessageHasRead', _buildParam({'userID': userID})); - - /// Mark group chat all messages as read /// 标记群聊会话已读 + /// [groupID] 群id Future markGroupMessageHasRead({ required String groupID, String? operationID, @@ -143,7 +137,6 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Get the total number of unread messages /// 获取未读消息总数 Future getTotalUnreadMsgCount({ String? operationID, @@ -154,9 +147,6 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Query conversation id - /// [sourceID] if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID - /// [sessionType] if it is a single chat, it value is 1. if it is a group chat, it value is 2 /// 查询会话id /// [sourceID] 如果是单聊值传用户ID,如果是群聊值传组ID /// [sessionType] 如果是单聊值传1,如果是群聊值传2 @@ -171,9 +161,8 @@ class ConversationManager { "sessionType": sessionType, })); - /// Message Do Not Disturb - /// [status] 0: Normal. 1: Do not receive messages. 2: Do not notify when messages are received. /// 消息免打扰设置 + /// [conversationIDList] 会话id列表 /// [status] 0:正常;1:不接受消息;2:接受在线消息不接受离线消息; Future setConversationRecvMessageOpt({ required List conversationIDList, @@ -188,9 +177,9 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Message Do Not Disturb - /// [{"conversationId":"single_13922222222","result":0}] /// 查询免打扰状态 + /// [conversationIDList] 会话id列表 + /// 返回:[{"conversationId":"single_13922222222","result":0}],result值:0:正常;1:不接受消息;2:接受在线消息不接受离线消息; Future> getConversationRecvMessageOpt({ required List conversationIDList, String? operationID, @@ -204,8 +193,9 @@ class ConversationManager { })) .then((value) => Utils.toListMap(value)); - /// burn after reading /// 阅后即焚 + /// [conversationID] 会话id + /// [isPrivate] true:开启,false:关闭 Future setOneConversationPrivateChat({ required String conversationID, required bool isPrivate, @@ -219,8 +209,8 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Delete conversation from local and service - /// 删除会话 + /// 删除本地以及服务器的会话 + /// [conversationID] 会话ID Future deleteConversationFromLocalAndSvr({ required String conversationID, String? operationID, @@ -232,8 +222,7 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Delete conversation from local - /// 删除会话 + /// 删除所有本地会话 Future deleteAllConversationFromLocal({ String? operationID, }) => @@ -243,8 +232,8 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Reset group converstaion at type - /// 重置at标准位 + /// 重置强提醒标识[GroupAtType] + /// [conversationID] 会话id Future resetConversationGroupAtType({ required String conversationID, String? operationID, @@ -256,13 +245,10 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Get @ all member tag - /// 查询at所有人标识 + /// 查询@所有人标识 Future getAtAllTag() => _channel.invokeMethod('getAtAllTag', _buildParam({})); - /// Global Do Not Disturb - /// [status] 0: Normal. 1: Do not receive messages. 2: Do not notify when messages are received. /// 全局免打扰 /// [status] 0:正常;1:不接受消息;2:接受在线消息不接受离线消息; Future setGlobalRecvMessageOpt({ @@ -276,7 +262,6 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); - /// Custom sort for conversation list /// 会话列表自定义排序规则。 List simpleSort(List list) => list ..sort((a, b) { diff --git a/lib/src/manager/im_friendship_manager.dart b/lib/src/manager/im_friendship_manager.dart index 6c4287f..687de61 100644 --- a/lib/src/manager/im_friendship_manager.dart +++ b/lib/src/manager/im_friendship_manager.dart @@ -7,16 +7,14 @@ class FriendshipManager { FriendshipManager(this._channel); - /// Set up a friend relationship listener /// 好友关系监听 Future setFriendshipListener(OnFriendshipListener listener) { this.listener = listener; return _channel.invokeMethod('setFriendListener', _buildParam({})); } - /// Get friend info by user id /// 查询好友信息 - /// [uidList] 好友的userID集合 + /// [uidList] userID集合 Future> getFriendsInfo({ required List uidList, String? operationID, @@ -30,10 +28,9 @@ class FriendshipManager { })) .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); - /// Send an friend application /// 发送一个好友请求,需要对方调用同意申请才能成为好友。 /// [uid] 被邀请的用户ID - /// [reason] 说明 + /// [reason] 备注说明 Future addFriend({ required String uid, String? reason, @@ -47,7 +44,6 @@ class FriendshipManager { "operationID": Utils.checkOperationID(operationID), })); - /// Get someone's request to add me as a friend /// 获取别人加我为好友的申请 Future> getRecvFriendApplicationList( {String? operationID}) => @@ -60,7 +56,6 @@ class FriendshipManager { .then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); - /// Get friend requests from me /// 获取我发出的好友申请 Future> getSendFriendApplicationList( {String? operationID}) => @@ -73,8 +68,7 @@ class FriendshipManager { .then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); - /// Find all friends including those who have been added to the blacklist - /// 获取好友列表包含已拉入黑名单的好友 + /// 获取好友列表,返回的列表包含了已拉入黑名单的好友 Future> getFriendList({String? operationID}) => _channel .invokeMethod( 'getFriendList', @@ -83,8 +77,7 @@ class FriendshipManager { })) .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); - /// Find all friends including those who have been added to the blacklist - /// 获取好友列表 + /// 获取好友列表,返回的列表包含了已拉入黑名单的好友 Future> getFriendListMap({String? operationID}) => _channel .invokeMethod( 'getFriendList', @@ -93,7 +86,6 @@ class FriendshipManager { })) .then((value) => Utils.toListMap(value)); - /// Modify friend remark name /// 设置好友备注 /// [uid] 好友的userID /// [remark] 好友的备注 @@ -110,9 +102,8 @@ class FriendshipManager { "operationID": Utils.checkOperationID(operationID), })); - /// Add friends to blacklist /// 加入黑名单 - /// [uid]被加入黑名单的好友ID + /// [uid] 被加入黑名单的好友ID Future addBlacklist({ required String uid, String? operationID, @@ -124,7 +115,6 @@ class FriendshipManager { "operationID": Utils.checkOperationID(operationID), })); - /// Find all blacklist /// 获取黑名单列表 Future> getBlacklist({String? operationID}) => _channel .invokeMethod( @@ -134,8 +124,8 @@ class FriendshipManager { })) .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); - /// Remove from blacklist /// 从黑名单移除 + /// [uid] 用户ID Future removeBlacklist({ required String uid, String? operationID, @@ -147,8 +137,8 @@ class FriendshipManager { "operationID": Utils.checkOperationID(operationID), })); - /// Determine if there is a friendship by userId /// 检查友好关系 + /// [uidList] userID列表 Future> checkFriend({ required List uidList, String? operationID, @@ -163,8 +153,8 @@ class FriendshipManager { .then((value) => Utils.toList(value, (v) => FriendshipInfo.fromJson(v))); - /// Dissolve friendship from friend list /// 删除好友 + /// [uid] 用户ID Future deleteFriend({ required String uid, String? operationID, @@ -176,8 +166,9 @@ class FriendshipManager { "operationID": Utils.checkOperationID(operationID), })); - /// Accept application of be friend /// 接受好友请求 + /// [uid] 用户ID + /// [handleMsg]备注说明 Future acceptFriendApplication({ required String uid, String? handleMsg, @@ -191,8 +182,9 @@ class FriendshipManager { "operationID": Utils.checkOperationID(operationID), })); - /// Refuse application of be friend /// 拒绝好友请求 + /// [uid] 用户ID + /// [handleMsg]备注说明 Future refuseFriendApplication({ required String uid, String? handleMsg, @@ -206,7 +198,6 @@ class FriendshipManager { "operationID": Utils.checkOperationID(operationID), })); - /// Search friends /// 查好友 /// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空 /// [isSearchUserID] 是否以关键词搜索好友ID(注:不可以同时为false),为空默认false diff --git a/lib/src/manager/im_group_manager.dart b/lib/src/manager/im_group_manager.dart index 73c743b..c780131 100644 --- a/lib/src/manager/im_group_manager.dart +++ b/lib/src/manager/im_group_manager.dart @@ -7,15 +7,15 @@ class GroupManager { GroupManager(this._channel); - /// Set up group relationship monitoring /// 组关系监听 Future setGroupListener(OnGroupListener listener) { this.listener = listener; return _channel.invokeMethod('setGroupListener', _buildParam({})); } - /// Invite friends into the group /// 邀请进组,直接进组无需同意。 + /// [groupId] 组ID + /// [uidList] 用户ID列表 Future> inviteUserToGroup({ required String groupId, required List uidList, @@ -34,8 +34,10 @@ class GroupManager { .then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map))); - /// Remove member from group /// 移除组成员 + /// [groupId] 组ID + /// [uidList] 用户ID列表 + /// [reason] 备注说明 Future> kickGroupMember({ required String groupId, required List uidList, @@ -54,8 +56,9 @@ class GroupManager { .then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map))); - /// Get group member's info /// 查询组成员资料 + /// [groupId] 组ID + /// [uidList] 用户ID列表 Future> getGroupMembersInfo({ required String groupId, required List uidList, @@ -72,10 +75,9 @@ class GroupManager { .then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); - /// Get the list of group members /// 分页获取组成员列表 /// [groupId] 群ID - /// [filter] 过滤成员 1普通成员, 2群主,3管理员,0所有 + /// [filter] 过滤成员 1普通成员, 2群主,3管理员,0 所有 /// [offset] 开始下标 /// [count] 总数 Future> getGroupMemberList({ @@ -98,7 +100,6 @@ class GroupManager { .then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); - /// Get the list of group members /// 分页获取组成员列表 /// [groupId] 群ID /// [filter] 过滤成员 1普通成员, 2群主,3管理员,0所有 @@ -123,7 +124,6 @@ class GroupManager { })) .then((value) => Utils.toListMap(value)); - /// Find all groups you have joined /// 查询已加入的组列表 Future> getJoinedGroupList({String? operationID}) => _channel .invokeMethod( @@ -133,7 +133,6 @@ class GroupManager { })) .then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map))); - /// Find all groups you have joined /// 查询已加入的组列表 Future> getJoinedGroupListMap({String? operationID}) => _channel .invokeMethod( @@ -143,8 +142,8 @@ class GroupManager { })) .then((value) => Utils.toListMap(value)); - /// Check if you are a member of the group /// 检查是否已加入组 + /// [gid] 组ID Future isJoinedGroup({ required String gid, String? operationID, @@ -153,14 +152,14 @@ class GroupManager { operationID: Utils.checkOperationID(operationID), ).then((list) => list.where((e) => e.groupID == gid).length > 0); - /// Create a group /// 创建一个组 /// [groupName] 群名 /// [notification] 公告 /// [introduction] 群介绍 /// [faceUrl] 群头像 + /// [groupType] 组类型 /// [ex] 额外信息 - /// [list] 初创群成员以及其角色 + /// [list] 初创群成员以及其角色列表,角色参考[GroupRoleLevel]类 Future createGroup({ String? groupName, String? notification, @@ -189,7 +188,6 @@ class GroupManager { .then( (value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map))); - /// Edit group information /// 编辑组资料 /// [groupID] 被编辑的群ID /// [groupName] 新的群名 @@ -197,6 +195,7 @@ class GroupManager { /// [introduction] 新的群介绍 /// [faceUrl] 新的群头像 /// [ex] 新的额外信息 + /// [needVerification] 进群设置,参考[GroupVerification]类 Future setGroupInfo({ required String groupID, String? groupName, @@ -204,6 +203,7 @@ class GroupManager { String? introduction, String? faceUrl, String? ex, + int needVerification = 0, String? operationID, }) => _channel.invokeMethod( @@ -217,12 +217,13 @@ class GroupManager { "introduction": introduction, "faceURL": faceUrl, "ex": ex, + "needVerification": needVerification, }, 'operationID': Utils.checkOperationID(operationID), })); - /// Find group information by group id /// 查询组信息 + /// [gidList] 组ID列表 Future> getGroupsInfo({ required List gidList, String? operationID, @@ -237,7 +238,6 @@ class GroupManager { .then( (value) => Utils.toList(value, (map) => GroupInfo.fromJson(map))); - /// Apply to join the group /// 申请加入组,需要通过管理员/群组同意。 Future joinGroup({ required String gid, @@ -252,7 +252,6 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Leave group /// 退出组 Future quitGroup({ required String gid, @@ -265,8 +264,9 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Give group permissions to others /// 转移组拥有者权限 + /// [gid] 组ID + /// [uid] 新拥有者ID Future transferGroupOwner({ required String gid, required String uid, @@ -280,7 +280,6 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// As the group owner or administrator, the group member's application to join the group received /// 作为群主或者管理员,收到的群成员入群申请 Future> getRecvGroupApplicationList( {String? operationID}) => @@ -293,7 +292,6 @@ class GroupManager { .then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); - /// Get the record of the group membership application issued by yourself /// 获取自己发出的入群申请记录 Future> getSendGroupApplicationList( {String? operationID}) => @@ -306,9 +304,10 @@ class GroupManager { .then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); - /// Accept group application /// 管理员或者群主同意某人进入某群 /// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理 + /// [gid] 组id + /// [uid] 申请者用户ID Future acceptGroupApplication({ required String gid, required String uid, @@ -324,9 +323,11 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Refuse group application /// 管理员或者群主拒绝某人进入某群 /// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理 + /// [gid] 组id + /// [uid] 申请者用户ID + /// [handleMsg] 说明 Future refuseGroupApplication({ required String gid, required String uid, @@ -342,8 +343,8 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Dissmiss group /// 解散群 + /// [groupID] 群ID Future dismissGroup({ required String groupID, String? operationID, @@ -355,7 +356,6 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Enable group mute /// 开启群禁言,所有群成员禁止发言 /// [groupID] 将开启群禁言的组ID /// [mute] true:开启,false:关闭 @@ -372,11 +372,10 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Mute group members /// 禁言群成员 /// [groupID] 群ID /// [userID] 将被禁言的成员ID - /// [seconds] 被禁言的时间s,设置为0则为接触禁言 + /// [seconds] 被禁言的时间s,设置为0则为解除禁言 Future changeGroupMemberMute({ required String groupID, required String userID, @@ -392,7 +391,6 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Set group user nickname /// 设置群成员昵称 /// [groupID] 群ID /// [userID] 群成员的用户ID @@ -412,7 +410,6 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Search group /// 查询群 /// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空 /// [isSearchGroupID] 是否以关键词搜索群ID(注:两个不可以同时为false),为空默认false @@ -437,11 +434,10 @@ class GroupManager { .then( (value) => Utils.toList(value, (map) => GroupInfo.fromJson(map))); - /// Set group user role /// 设置群成员权限 /// [groupID] 群ID /// [userID] 群成员的用户ID - /// [roleLevel] 角色等级 + /// [roleLevel] 角色等级,参考[GroupRoleLevel] Future setGroupMemberRoleLevel({ required String groupID, required String userID, @@ -457,8 +453,7 @@ class GroupManager { 'operationID': Utils.checkOperationID(operationID), })); - /// Get the list of group members - /// 分页获取组成员列表 + /// 根据加入时间分页获取组成员列表 /// [groupID] 群ID /// [joinTimeBegin] 加入开始时间 /// [joinTimeEnd] 加入结束时间 diff --git a/lib/src/manager/im_manager.dart b/lib/src/manager/im_manager.dart index 0f03d0d..3fe24fb 100644 --- a/lib/src/manager/im_manager.dart +++ b/lib/src/manager/im_manager.dart @@ -289,23 +289,13 @@ class IMManager { }); } - /// Initialize SDK - /// - /// [platform] platform number [IMPlatform] - /// [apiAddr] api server ip address - /// [wsAddr] webSocket ip address - /// [dataDir] data storage directory - /// [objectStorage] storage object: cos/minio - /// [logLevel] log level: 1-not print - /// /// 初始化SDK - /// /// [platform] 平台编号[IMPlatform] /// [apiAddr] SDK api地址 /// [wsAddr] SDK websocket地址 /// [dataDir] SDK数据库存储目录 /// [objectStorage] 存储对象 cos/minio - /// [logLevel] 日志 1-不打印 + /// [logLevel] 日志 1不打印 Future initSDK({ required int platform, required String apiAddr, @@ -338,10 +328,9 @@ class IMManager { return _channel.invokeMethod('unInitSDK', _buildParam({})); } - /// Login sdk /// 登录 - /// [uid]用户id - /// [token]登录token,从业务服务器上获取 + /// [uid] 用户id + /// [token] 登录token,从业务服务器上获取 Future login({ required String uid, required String token, @@ -362,7 +351,6 @@ class IMManager { return uInfo; } - /// Logout sdk /// 登出 Future logout({String? operationID}) async { var value = await _channel.invokeMethod( @@ -375,19 +363,16 @@ class IMManager { return value; } - /// + /// 获取登录状态 Future getLoginStatus() => _channel.invokeMethod('getLoginStatus', _buildParam({})); - /// Current user id /// 获取当前登录用户id Future getLoginUserID() async => uid; - /// Current user info /// 获取当前登录用户信息 Future getLoginUserInfo() async => uInfo; - /// wakeup /// 从后台回到前台立刻唤醒 Future wakeUp({String? operationID}) => _channel.invokeMethod( 'wakeUp', @@ -395,7 +380,6 @@ class IMManager { 'operationID': Utils.checkOperationID(operationID), })); - /// upload image to server /// 上传图片到服务器 /// [path]图片路径 /// [token] im token diff --git a/lib/src/manager/im_message_manager.dart b/lib/src/manager/im_message_manager.dart index 3d01153..ec68faf 100644 --- a/lib/src/manager/im_message_manager.dart +++ b/lib/src/manager/im_message_manager.dart @@ -10,7 +10,6 @@ class MessageManager { MessageManager(this._channel); - /// Set a message listener /// 消息监听 Future setAdvancedMsgListener(OnAdvancedMsgListener listener) { this.msgListener = listener; @@ -22,18 +21,16 @@ class MessageManager { })); } - /// Set up message sending progress monitoring /// 消息发送进度监听 void setMsgSendProgressListener(OnMsgSendProgressListener listener) { msgSendProgressListener = listener; } - /// Send a message to user or to group - /// [userID] receiver's user ID /// 发送消息 - /// [userID]接收消息的用户id - /// [groupID]接收消息的组id - /// [offlinePushInfo]离线消息显示内容 + /// [message] 消息体 + /// [userID] 接收消息的用户id + /// [groupID] 接收消息的组id + /// [offlinePushInfo] 离线消息显示内容 Future sendMessage({ required Message message, required OfflinePushInfo offlinePushInfo, @@ -53,7 +50,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Find all history message /// 获取聊天记录(以startMsg为节点,以前的聊天记录) /// [userID] 接收消息的用户id /// [conversationID] 会话id,查询通知时可用 @@ -81,8 +77,8 @@ class MessageManager { })) .then((value) => Utils.toList(value, (map) => Message.fromJson(map))); - /// Revoke the sent information /// 撤回消息 + /// [message] 被撤回的消息体 Future revokeMessage({ required Message message, String? operationID, @@ -94,8 +90,8 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), }))); - /// Delete message /// 删除本地消息 + /// [message] 被删除的消息体 Future deleteMessageFromLocalStorage({ required Message message, String? operationID, @@ -107,12 +103,10 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), }))); - /// - // Future deleteMessages({required List msgList}) => - // _channel.invokeMethod('deleteMessages', - // _buildParam({"msgList": msgList.map((e) => e.toJson()).toList()})); - /// 插入单聊消息到本地 + /// [receiverID] 接收者id + /// [senderID] 发送者id + /// [message] 消息体 Future insertSingleMessageToLocalStorage({ String? receiverID, String? senderID, @@ -131,6 +125,9 @@ class MessageManager { .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); /// 插入群聊消息到本地 + /// [groupID] 群id + /// [senderID] 发送者id + /// [message] 消息体 Future insertGroupMessageToLocalStorage({ String? groupID, String? senderID, @@ -148,8 +145,9 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Mark c2c message as read - /// 标记c2c消息已读 + /// 标记c2c单条消息已读 + /// [userID] 消息来源的userID + /// [messageIDList] 消息clientMsgID集合 Future markC2CMessageAsRead({ required String userID, required List messageIDList, @@ -163,8 +161,9 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Mark group message as read /// 标记群聊消息已读 + /// [groupID] 群id + /// [messageIDList] 消息clientMsgID集合 Future markGroupMessageAsRead({ required String groupID, required List messageIDList, @@ -178,7 +177,6 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Typing /// 正在输入提示 /// [msgTip] 自定义内容 Future typingStatusUpdate({ @@ -194,7 +192,6 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Create text message /// 创建文本消息 Future createTextMessage({ required String text, @@ -209,7 +206,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create @ message /// 创建@消息 /// [text] 输入内容 /// [atUserIDList] 被@到的userID集合 @@ -235,8 +231,8 @@ class MessageManager { ) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create picture message /// 创建图片消息 + /// [imagePath] 路径 Future createImageMessage({ required String imagePath, String? operationID, @@ -251,7 +247,6 @@ class MessageManager { ) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create picture message /// 创建图片消息 /// [imagePath] 路径 Future createImageMessageFromFullPath({ @@ -268,8 +263,9 @@ class MessageManager { ) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create sound message /// 创建语音消息 + /// [soundPath] 路径 + /// [duration] 时长s Future createSoundMessage({ required String soundPath, required int duration, @@ -286,7 +282,6 @@ class MessageManager { ) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create sound message /// 创建语音消息 /// [soundPath] 路径 /// [duration] 时长s @@ -306,8 +301,11 @@ class MessageManager { ) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create video message /// 创建视频消息 + /// [videoPath] 路径 + /// [videoType] 视频mime类型 + /// [duration] 时长s + /// [snapshotPath] 默认站位图路径 Future createVideoMessage({ required String videoPath, required String videoType, @@ -327,7 +325,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create video message /// 创建视频消息 /// [videoPath] 路径 /// [videoType] 视频mime类型 @@ -352,8 +349,9 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create file message /// 创建文件消息 + /// [filePath] 路径 + /// [fileName] 文件名 Future createFileMessage({ required String filePath, required String fileName, @@ -370,7 +368,6 @@ class MessageManager { .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); } - /// Create file message /// 创建文件消息 /// [filePath] 路径 /// [fileName] 文件名 @@ -389,7 +386,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create merger message /// 创建合并消息 /// [messageList] 被选中的消息 /// [title] 摘要标题 @@ -411,7 +407,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create forward message /// 创建转发消息 /// [message] 被转发的消息 Future createForwardMessage({ @@ -428,7 +423,6 @@ class MessageManager { .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); } - /// Create location message /// 创建位置消息 /// [latitude] 纬度 /// [longitude] 经度 @@ -450,8 +444,10 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create custom message /// 创建自定义消息 + /// [data] 自定义数据 + /// [extension] 自定义扩展内容 + /// [description] 自定义描述内容 Future createCustomMessage({ required String data, required String extension, @@ -469,7 +465,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create quote message /// 创建引用消息 /// [text] 回复的内容 /// [quoteMsg] 被回复的消息 @@ -488,8 +483,8 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create card message /// 创建卡片消息 + /// [data] 自定义数据 Future createCardMessage({ required Map data, String? operationID, @@ -503,9 +498,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Create custom emoji message - /// [index] The position of the emoji, such as the position emoji - /// [data] Other data, such as url expressions /// 创建自定义表情消息 /// [index] 位置表情,根据index匹配 /// [data] url表情,直接使用url显示 @@ -524,8 +516,8 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// Clear all c2c history message /// 清空单聊消息记录 + /// [uid] 单聊对象id Future clearC2CHistoryMessage({ required String uid, String? operationID, @@ -537,8 +529,8 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Clear all group history /// 清空组消息记录 + /// [gid] 组id Future clearGroupHistoryMessage({ required String gid, String? operationID, @@ -550,17 +542,16 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Search local message /// 搜索消息 /// [conversationID] 根据会话查询,如果是全局搜索传null - /// [keywordList]搜索关键词列表,目前仅支持一个关键词搜索 - /// [keywordListMatchType]关键词匹配模式,1代表与,2代表或,暂时未用 - /// [senderUserIDList]指定消息发送的uid列表 暂时未用 - /// [messageTypeList]消息类型列表 - /// [searchTimePosition]搜索的起始时间点。默认为0即代表从现在开始搜索。UTC 时间戳,单位:秒 - /// [searchTimePeriod]从起始时间点开始的过去时间范围,单位秒。默认为0即代表不限制时间范围,传24x60x60代表过去一天 - /// [pageIndex]当前页数 - /// [count]每页数量 + /// [keywordList] 搜索关键词列表,目前仅支持一个关键词搜索 + /// [keywordListMatchType] 关键词匹配模式,1代表与,2代表或,暂时未用 + /// [senderUserIDList] 指定消息发送的uid列表 暂时未用 + /// [messageTypeList] 消息类型列表 + /// [searchTimePosition] 搜索的起始时间点。默认为0即代表从现在开始搜索。UTC 时间戳,单位:秒 + /// [searchTimePeriod] 从起始时间点开始的过去时间范围,单位秒。默认为0即代表不限制时间范围,传24x60x60代表过去一天 + /// [pageIndex] 当前页数 + /// [count] 每页数量 Future searchLocalMessages({ String? conversationID, List keywordList = const [], @@ -593,8 +584,8 @@ class MessageManager { .then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map))); - /// Delete message from local and service /// 删除本地跟服务器的指定的消息 + /// [message] 被删除的消息 Future deleteMessageFromLocalAndSvr({ required Message message, String? operationID, @@ -606,7 +597,6 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), }))); - /// Delete all message from local /// 删除本地所有聊天记录 Future deleteAllMsgFromLocal({ String? operationID, @@ -617,7 +607,6 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Delete all message from service /// 删除本地跟服务器所有聊天记录 Future deleteAllMsgFromLocalAndSvr({ String? operationID, @@ -628,7 +617,6 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Mark conversation message as read /// 标记消息已读 /// [conversationID] 会话ID /// [messageIDList] 被标记的消息clientMsgID @@ -645,8 +633,8 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Clear all c2c history message /// 删除本地跟服务器的单聊聊天记录 + /// [uid] 聊天对象的userID Future clearC2CHistoryMessageFromLocalAndSvr({ required String uid, String? operationID, @@ -658,8 +646,8 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Clear all group history /// 删除本地跟服务器的群聊天记录 + /// [gid] 组id Future clearGroupHistoryMessageFromLocalAndSvr({ required String gid, String? operationID, @@ -671,7 +659,6 @@ class MessageManager { "operationID": Utils.checkOperationID(operationID), })); - /// Find all history message /// 获取聊天记录(以startMsg为节点,新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息 /// [userID] 接收消息的用户id /// [conversationID] 会话id,查询通知时可用 diff --git a/lib/src/manager/im_organization_manager.dart b/lib/src/manager/im_organization_manager.dart index 0475bdf..b1e96b6 100644 --- a/lib/src/manager/im_organization_manager.dart +++ b/lib/src/manager/im_organization_manager.dart @@ -7,15 +7,16 @@ class OrganizationManager { OrganizationManager(this._channel); - /// Observe organization info changes /// 组织架构发生变化回调 Future setOrganizationListener(OnOrganizationListener listener) { this.listener = listener; return _channel.invokeMethod('setOrganizationListener', _buildParam({})); } - /// Query sub department - /// 获取子部门列表 + /// 获取子部门列表,返回当前部门下的一级子部门 + /// [departmentID] 当前部门id + /// [offset] 开始下标 + /// [count] 每页大小 Future> getSubDept({ required String departmentID, int offset = 0, @@ -33,8 +34,10 @@ class OrganizationManager { })) .then((value) => Utils.toList(value, (v) => DeptInfo.fromJson(v))); - /// Get member under a department - /// 获取部门下的成员列表 + /// 获取部门下的成员列表,返回当前部门下的一级成员 + /// [departmentID] 当前部门id + /// [offset] 开始下标 + /// [count] 每页大小 Future> getDeptMember({ required String departmentID, int offset = 0, @@ -53,8 +56,8 @@ class OrganizationManager { .then((value) => Utils.toList(value, (v) => DeptMemberInfo.fromJson(v))); - /// Get member's department /// 获取成员所在的部门 + /// [userID] 成员ID Future> getUserInDept({ required String userID, String? operationID, @@ -68,8 +71,8 @@ class OrganizationManager { })) .then((value) => Utils.toList(value, (v) => UserInDept.fromJson(v))); - /// Get the sub-departments and employees under the department /// 获取部门下的子部门跟员工 + /// [departmentID] 当前部门id Future getDeptMemberAndSubDept({ required String departmentID, // int departmentOffset = 0, @@ -92,8 +95,8 @@ class OrganizationManager { .then((value) => Utils.toObj(value, (v) => DeptMemberAndSubDept.fromJson(v))); - /// Query department info /// 查询部门信息 + /// [departmentID] 部门ID Future getDeptInfo({ required String departmentID, String? operationID, @@ -107,8 +110,17 @@ class OrganizationManager { })) .then((value) => Utils.toObj(value, (v) => DeptInfo.fromJson(v))); - /// Search /// 搜索组织人员 + /// [keyWord] 关键字 + /// [isSearchUserName] 是否匹配用户名 + /// [isSearchEnglishName] 是否匹配英文名 + /// [isSearchPosition] 是否匹配职位 + /// [isSearchUserID] 是否匹配用户ID + /// [isSearchMobile] 是否匹配手机号 + /// [isSearchEmail] 是否匹配邮箱号 + /// [isSearchTelephone] 是否匹配电话号码 + /// [offset] 开始下标 + /// [count] 分页大小 Future searchOrganization({ required String keyWord, bool isSearchUserName = false, diff --git a/lib/src/manager/im_signaling_manager.dart b/lib/src/manager/im_signaling_manager.dart index 2911cbf..d4d7d38 100644 --- a/lib/src/manager/im_signaling_manager.dart +++ b/lib/src/manager/im_signaling_manager.dart @@ -15,6 +15,7 @@ class SignalingManager { } /// 邀请个人加入音视频 + /// [info] 信令对象[SignalingInfo] Future signalingInvite({ required SignalingInfo info, String? operationID, @@ -30,6 +31,7 @@ class SignalingManager { Utils.toObj(value, (map) => SignalingCertificate.fromJson(map))); /// 邀请群里某些人加入音视频 + /// [info] 信令对象[SignalingInfo] Future signalingInviteInGroup({ required SignalingInfo info, String? operationID, @@ -45,6 +47,7 @@ class SignalingManager { Utils.toObj(value, (map) => SignalingCertificate.fromJson(map))); /// 同意某人音视频邀请 + /// [info] 信令对象[SignalingInfo] Future signalingAccept({ required SignalingInfo info, String? operationID, @@ -60,6 +63,7 @@ class SignalingManager { Utils.toObj(value, (map) => SignalingCertificate.fromJson(map))); /// 拒绝某人音视频邀请 + /// [info] 信令对象[SignalingInfo] Future signalingReject({ required SignalingInfo info, String? operationID, @@ -72,6 +76,7 @@ class SignalingManager { })); /// 邀请者取消音视频通话 + /// [info] 信令对象[SignalingInfo] Future signalingCancel({ required SignalingInfo info, String? operationID, @@ -84,6 +89,7 @@ class SignalingManager { })); /// 挂断 + /// [info] 信令对象[SignalingInfo] Future signalingHungUp({ required SignalingInfo info, String? operationID, diff --git a/lib/src/manager/im_user_manager.dart b/lib/src/manager/im_user_manager.dart index 4381170..99aa744 100644 --- a/lib/src/manager/im_user_manager.dart +++ b/lib/src/manager/im_user_manager.dart @@ -7,15 +7,14 @@ class UserManager { UserManager(this._channel); - /// Observe user info changes /// 用户资料改变监听 Future setUserListener(OnUserListener listener) { this.listener = listener; return _channel.invokeMethod('setUserListener', _buildParam({})); } - /// Query user information /// 获取用户资料 + /// [uidList] 用户ID列表 Future> getUsersInfo({ required List uidList, String? operationID, @@ -29,7 +28,6 @@ class UserManager { })) .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); - /// Get the information of the currently logged in user /// 获取当前登录用户的信息 Future getSelfUserInfo({ String? operationID, @@ -42,8 +40,15 @@ class UserManager { })) .then((value) => Utils.toObj(value, (map) => UserInfo.fromJson(map))); - /// Modify current user info /// 修改当前登录用户资料 + /// [nickname] 昵称 + /// [faceURL] 头像 + /// [gender] 性别 + /// [appMangerLevel] + /// [phoneNumber] 手机号 + /// [birth] 出生日期 + /// [email] 邮箱 + /// [ex] 扩展字段 Future setSelfInfo({ String? nickname, String? faceURL, diff --git a/lib/src/manager/im_workmoments_manager.dart b/lib/src/manager/im_workmoments_manager.dart index b11966e..08c1134 100644 --- a/lib/src/manager/im_workmoments_manager.dart +++ b/lib/src/manager/im_workmoments_manager.dart @@ -7,13 +7,13 @@ class WorkMomentsManager { WorkMomentsManager(this._channel); - /// Observe work moments changes + /// 朋友圈信息发送变化通知 Future setWorkMomentsListener(OnWorkMomentsListener listener) { this.listener = listener; return _channel.invokeMethod('setWorkMomentsListener', _buildParam({})); } - /// Get work moments unread count + /// 获取朋友圈未读消息总数 Future getWorkMomentsUnReadCount({ String? operationID, }) => @@ -25,7 +25,9 @@ class WorkMomentsManager { })) .then((value) => Utils.toObj(value, (map) => map['unreadCount'])); - /// Get work moments notification list + /// 获取通知列表 + /// [offset] 开始下标 + /// [count] 每页大小 Future> getWorkMomentsNotification({ required int offset, required int count, @@ -42,7 +44,7 @@ class WorkMomentsManager { .then((value) => Utils.toList(value, (map) => WorkMomentsInfo.fromJson(map))); - /// Clear work moments notification + /// 清除通知列表 Future clearWorkMomentsNotification({ String? operationID, }) => diff --git a/lib/src/models/conversation_info.dart b/lib/src/models/conversation_info.dart index 0579fd4..a0d89f2 100644 --- a/lib/src/models/conversation_info.dart +++ b/lib/src/models/conversation_info.dart @@ -3,24 +3,55 @@ import 'dart:convert'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; class ConversationInfo { + /// 会话ID String conversationID; - /// [ConversationType] + /// 会话类型[ConversationType] int? conversationType; + + /// 参与会话的userID String? userID; + + /// 参与会话的groupID String? groupID; + + /// 昵称 String? showName; + + /// 头像 String? faceURL; + + /// 免打扰 0:正常;1:不接受消息;2:接受在线消息不接受离线消息; int? recvMsgOpt; + + /// 未读消息数 int? unreadCount; + + /// 强制提示,[GroupAtType]包含@所有人,@个人以及公告提示 int? groupAtType; + + /// 会话最新消息内容 Message? latestMsg; + + /// 最新消息发送时间 int? latestMsgSendTime; + + /// 草稿 String? draftText; + + /// 草稿生成时间 int? draftTextTime; + + /// 是否置顶 bool? isPinned; + + /// 是否开启了私聊(阅后即焚) bool? isPrivateChat; + + /// 附加内容 String? ext; + + /// 是否还在组内,如果退群返回true bool? isNotInGroup; ConversationInfo({ diff --git a/lib/src/models/group_info.dart b/lib/src/models/group_info.dart index 5137192..b543b67 100644 --- a/lib/src/models/group_info.dart +++ b/lib/src/models/group_info.dart @@ -1,19 +1,46 @@ +import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; + +/// 群信息 class GroupInfo { + /// 群ID String groupID; + + /// 群名 String? groupName; + + /// 群公告 String? notification; + + /// 群简介 String? introduction; + + /// 群头像 String? faceURL; + + /// 拥有者ID String? ownerUserID; + + /// 创建时间 int? createTime; + + /// 群成员数 int? memberCount; - /// ok = 0 blocked = 1 Dismissed = 2 Muted = 3 + /// 群状态:0正常,1被封,2解散,3禁言 int? status; + + /// 创建者ID String? creatorUserID; + + /// 群类型 int? groupType; + + /// 扩展字段 String? ex; + /// 进群验证方式[GroupVerification] + int? needVerification; + GroupInfo({ required this.groupID, this.groupName, @@ -27,6 +54,7 @@ class GroupInfo { this.creatorUserID, this.groupType, this.ex, + this.needVerification, }); GroupInfo.fromJson(Map json) : groupID = json['groupID'] { @@ -42,6 +70,7 @@ class GroupInfo { creatorUserID = json['creatorUserID']; groupType = json['groupType']; ex = json['ex']; + needVerification = json['needVerification']; } Map toJson() { @@ -58,20 +87,41 @@ class GroupInfo { data['creatorUserID'] = this.creatorUserID; data['groupType'] = this.groupType; data['ex'] = this.ex; + data['needVerification'] = this.needVerification; return data; } } +/// 群成员信息 class GroupMembersInfo { + /// 群id String? groupID; + + /// 用户id String? userID; + + /// 昵称 String? nickname; + + /// 头像 String? faceURL; + + /// 角色[GroupRoleLevel] int? roleLevel; + + /// 加入时间 int? joinTime; + + /// 入群方式 int? joinSource; + + /// 操作者id String? operatorUserID; - String? ext; + + /// 扩展字段 + String? ex; + + /// 禁言时间s int? muteEndTime; int? appMangerLevel; @@ -82,7 +132,7 @@ class GroupMembersInfo { this.joinTime, this.nickname, this.faceURL, - this.ext, + this.ex, this.joinSource, this.operatorUserID, this.muteEndTime, @@ -96,7 +146,7 @@ class GroupMembersInfo { joinTime = json['joinTime']; nickname = json['nickname']; faceURL = json['faceURL']; - ext = json['ext']; + ex = json['ex']; joinSource = json['joinSource']; operatorUserID = json['operatorUserID']; muteEndTime = json['muteEndTime']; @@ -111,7 +161,7 @@ class GroupMembersInfo { data['joinTime'] = this.joinTime; data['nickname'] = this.nickname; data['faceURL'] = this.faceURL; - data['ext'] = this.ext; + data['ex'] = this.ex; data['joinSource'] = this.joinSource; data['operatorUserID'] = this.operatorUserID; data['muteEndTime'] = this.muteEndTime; @@ -120,11 +170,12 @@ class GroupMembersInfo { } } +/// 群成员角色 class GroupMemberRole { + /// 用户ID String? userID; - /// 1 ordinary member, 2 group owners, 3 administrators - /// 1普通成员, 2群主,3管理员 + /// [GroupRoleLevel] 1普通成员, 2群主,3管理员 int? roleLevel; GroupMemberRole({this.userID, this.roleLevel = 1}); @@ -142,31 +193,72 @@ class GroupMemberRole { } } +/// 群申请信息 class GroupApplicationInfo { + /// 群ID String? groupID; + + /// 群昵称 String? groupName; + + /// 群公告 String? notification; + + /// 群介绍 String? introduction; + + /// 群头像 String? groupFaceURL; + + /// 群创建时间 int? createTime; + + /// 群状态 int? status; + + /// 创建者id String? creatorUserID; + + /// 群类型 int? groupType; + + /// 拥有者id String? ownerUserID; + + /// 成员数量 int? memberCount; + + /// 发起入群申请的用户id String? userID; + + /// 发起入群申请的用户昵称 String? nickname; + + /// 发起入群申请的用户头像 String? userFaceURL; + + /// 发起入群申请的用户性别 int? gender; - /// REFUSE = -1, AGREE = 1 - /// -1:拒绝,1:同意 + /// 处理结果:-1:拒绝,1:同意 int? handleResult; + + /// 请求说明 String? reqMsg; + + /// 处理结果说明 String? handledMsg; + + /// 请求时间 int? reqTime; + + /// 处理者用户ID String? handleUserID; + + /// 处理时间 int? handledTime; + + /// 扩展信息 String? ex; GroupApplicationInfo({ diff --git a/lib/src/models/message.dart b/lib/src/models/message.dart index e67d715..f0c5295 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -1,43 +1,108 @@ +import 'dart:io'; + +import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; + class Message { + /// 消息id,唯一标识 String? clientMsgID; + + /// 服务端生成的id String? serverMsgID; + + /// 创建时间 int? createTime; + + /// 发送时间 int? sendTime; - /// [ConversationType] + /// 会话类型[ConversationType] int? sessionType; + + /// 发送者id String? sendID; + + /// 接收者id String? recvID; + + /// 来源 int? msgFrom; - /// [MessageType] + /// 消息类型[MessageType] int? contentType; + + /// 平台[Platform] int? platformID; + + /// 发送者昵称 String? senderNickname; + + /// 发送者头像 String? senderFaceUrl; + + /// 群ID String? groupID; + + /// 消息内容 String? content; + + /// 消息的seq int? seq; + + /// 是否已读 bool? isRead; + + /// 已读时间 int? hasReadTime; - /// [MessageStatus] + /// 消息发送状态[MessageStatus] int? status; + + /// 离线显示内容 OfflinePushInfo? offlinePush; + + /// 附加信息 String? attachedInfo; + + /// 扩展信息 String? ex; + + /// 自定义扩展信息,目前用于客服端处理消息时间分段 dynamic ext; + + /// 图片 PictureElem? pictureElem; + + /// 语音 SoundElem? soundElem; + + /// 视频 VideoElem? videoElem; + + /// 文件 FileElem? fileElem; + + /// @信息 AtElem? atElem; + + /// 位置 LocationElem? locationElem; + + /// 自定义 CustomElem? customElem; + + /// 引用 QuoteElem? quoteElem; + + /// 合并 MergeElem? mergeElem; + + /// 通知 NotificationElem? notificationElem; + + /// 自定义表情 FaceElem? faceElem; + + /// 附加信息 AttachedInfoElem? attachedInfoElem; Message({ @@ -224,10 +289,18 @@ class Message { } } +/// 图片消息内容 class PictureElem { + /// 原路径 String? sourcePath; + + /// 原图对象 PictureInfo? sourcePicture; + + /// 大图对象 PictureInfo? bigPicture; + + /// 缩率图对象 PictureInfo? snapshotPicture; PictureElem( @@ -265,12 +338,24 @@ class PictureElem { } } +/// 图片信息 class PictureInfo { + /// id String? uuid; + + /// 图片mime类型 String? type; + + /// 大小 int? size; + + /// 宽度 int? width; + + /// 长度 int? height; + + /// 图片URL地址 String? url; PictureInfo( @@ -297,11 +382,21 @@ class PictureInfo { } } +/// 语音消息内容 class SoundElem { + /// id String? uuid; + + /// 原路径 String? soundPath; + + /// url地址 String? sourceUrl; + + /// 大小 int? dataSize; + + /// 时间s int? duration; SoundElem( @@ -330,18 +425,42 @@ class SoundElem { } } +/// 视频消息内容 class VideoElem { + /// 视频路径 String? videoPath; + + /// uuid String? videoUUID; + + /// 视频的url地址 String? videoUrl; + + /// mime类型 String? videoType; + + /// 大小 int? videoSize; + + /// 时长s int? duration; + + /// 缩率图路径 String? snapshotPath; + + /// 缩率图uuid String? snapshotUUID; + + /// 缩率图大小 int? snapshotSize; + + /// 缩率图URL地址 String? snapshotUrl; + + /// 缩率图宽度 int? snapshotWidth; + + /// 缩率图高度 int? snapshotHeight; VideoElem( @@ -391,11 +510,21 @@ class VideoElem { } } +/// 文件消息内容 class FileElem { + /// 文件路径 String? filePath; + + /// uuid String? uuid; + + /// 文件URL地址 String? sourceUrl; + + /// 文件名 String? fileName; + + /// 文件大小 int? fileSize; FileElem( @@ -420,11 +549,21 @@ class FileElem { } } +/// @消息内容 class AtElem { + /// 消息内容 String? text; + + /// 被@的用户ID列表 List? atUserList; + + /// 是否包含自己 bool? isAtSelf; + + /// 被@的用户ID跟昵称关系列表,用于将消息内容里的用户id替换为昵称显示 List? atUsersInfo; + + /// 被回复的消息体,回复别人并@了人 Message? quoteMessage; AtElem({ @@ -462,9 +601,15 @@ class AtElem { } } +/// 位置消息内日 class LocationElem { + /// 位置描述 String? description; + + /// 经度 double? longitude; + + /// 纬度 double? latitude; LocationElem({this.description, this.longitude, this.latitude}); @@ -493,9 +638,15 @@ class LocationElem { } } +/// 自定义消息 class CustomElem { + /// 自定义数据 String? data; + + /// 扩展内容 String? extension; + + /// 描述内容 String? description; CustomElem({this.data, this.extension, this.description}); @@ -515,8 +666,12 @@ class CustomElem { } } +/// 引用消息(被回复的消息) class QuoteElem { + /// 回复内容内容 String? text; + + /// 被回复的消息体 Message? quoteMessage; QuoteElem({this.text, this.quoteMessage}); @@ -536,9 +691,15 @@ class QuoteElem { } } +/// 合并消息体 class MergeElem { + /// 标题 String? title; + + /// 摘要 List? abstractList; + + /// 具体选择合并的消息列表 List? multiMessage; MergeElem({this.title, this.abstractList, this.multiMessage}); @@ -564,8 +725,12 @@ class MergeElem { } } +/// 通知 class NotificationElem { + /// 详情 String? detail; + + /// 提示 String? defaultTips; NotificationElem({this.detail, this.defaultTips}); @@ -583,8 +748,12 @@ class NotificationElem { } } +/// 表情 class FaceElem { + /// 位置表情,用户端对端自定义内嵌的表情包 int? index; + + /// 其他表情,如URL表情直接返回url String? data; FaceElem({this.index, this.data}); @@ -602,12 +771,18 @@ class FaceElem { } } +/// 附加信息 class AttachedInfoElem { + /// 群消息已读信息 GroupHasReadInfo? groupHasReadInfo; - /// 单聊有效 + /// 是否为私聊消息(阅后即焚消息),单聊有效 bool? isPrivateChat; + + /// 已读时间 int? hasReadTime; + + /// 离线不发送推送 bool? notSenderNotificationPush; AttachedInfoElem({ @@ -636,9 +811,15 @@ class AttachedInfoElem { } } +/// 群消息已读信息 class GroupHasReadInfo { + /// 已读的用户id列表 List? hasReadUserIDList; + + /// 已读总数 int? hasReadCount; + + /// 发送此条消息时的群人数 int? groupMemberCount; GroupHasReadInfo.fromJson(Map json) { @@ -660,13 +841,27 @@ class GroupHasReadInfo { } } +/// 消息已读回执信息 class ReadReceiptInfo { + /// 发送者id String? userID; + + /// 群id String? groupID; + + /// 已读消息的clientMsgID集合 List? msgIDList; + + /// 读时间 int? readTime; + + /// 消息来源 int? msgFrom; + + /// 消息类型[MessageType] int? contentType; + + /// 会话类型[ConversationType] int? sessionType; ReadReceiptInfo( @@ -702,11 +897,21 @@ class ReadReceiptInfo { } } +/// 离线推送信息 class OfflinePushInfo { + /// 通知标题 String? title; + + /// 通知描述 String? desc; + + /// 扩展内容 String? ex; + + /// 仅ios有效 String? iOSPushSound; + + /// 仅ios有效 bool? iOSBadgeCount; OfflinePushInfo( @@ -731,8 +936,12 @@ class OfflinePushInfo { } } +/// @消息用户id跟昵称关系对象 class AtUserInfo { + /// 被@的用户id String? atUserID; + + /// 被@的用户昵称 String? groupNickname; AtUserInfo({this.atUserID, this.groupNickname}); diff --git a/lib/src/models/notification_info.dart b/lib/src/models/notification_info.dart index b59f89b..e20d7ed 100644 --- a/lib/src/models/notification_info.dart +++ b/lib/src/models/notification_info.dart @@ -1,25 +1,38 @@ import '../../flutter_openim_sdk.dart'; -/// OA notification /// oa 通知 class OANotification { + /// 标题 String? notificationName; + + /// 头像 String? notificationFaceURL; + + /// 类型 int? notificationType; + + /// 文本内容 String? text; + + /// 跳转链接 String? externalUrl; - /// Notification Mix Type - /// 0: Plain text notification - /// 1: Text+picture notification - /// 2: Text+video notification - /// 3: Text+file notification /// 0:纯文字通知 1:文字+图片通知 2:文字+视频通知 3:文字+文件通知 int? mixType; + + /// 图片信息 PictureElem? pictureElem; + + /// 语音信息 SoundElem? soundElem; + + /// 视频信息 VideoElem? videoElem; + + /// 文件信息 FileElem? fileElem; + + /// 扩展字段 String? ex; OANotification( @@ -81,11 +94,18 @@ class OANotification { } } -/// Group common notification +/// 群事件通知 class GroupNotification { + /// 群信息 GroupInfo? group; + + /// 当前事件操作者信息 GroupMembersInfo? opUser; + + /// 群拥有者信息 GroupMembersInfo? groupOwnerUser; + + /// 产生影响的群成员列表 List? memberList; GroupNotification({ @@ -129,11 +149,15 @@ class GroupNotification { } } -/// User is invited to the group notification /// 用户被邀请进群通知 class InvitedJoinGroupNotification { + /// 群信息 GroupInfo? group; + + /// 操作者信息 GroupMembersInfo? opUser; + + /// 被邀请进群的成员信息 List? invitedUserList; InvitedJoinGroupNotification({this.group, this.opUser, this.invitedUserList}); @@ -167,11 +191,15 @@ class InvitedJoinGroupNotification { } } -/// Group kicked member notification /// 组踢出成员通知 class KickedGroupMemeberNotification { + /// 群信息 GroupInfo? group; + + /// 操作者信息 GroupMembersInfo? opUser; + + /// 被踢出群的成员信息列表 List? kickedUserList; KickedGroupMemeberNotification( @@ -206,10 +234,12 @@ class KickedGroupMemeberNotification { } } -/// Exit group notification /// 退出群通知 class QuitGroupNotification { + /// 群信息 GroupInfo? group; + + /// 退群的成员信息 GroupMembersInfo? quitUser; QuitGroupNotification({this.group, this.quitUser}); @@ -233,10 +263,12 @@ class QuitGroupNotification { } } -/// Enter group notification /// 进群通知 class EnterGroupNotification { + /// 群信息 GroupInfo? group; + + /// 进入群的成员信息 GroupMembersInfo? entrantUser; EnterGroupNotification({this.group, this.entrantUser}); @@ -260,11 +292,15 @@ class EnterGroupNotification { } } -/// Group rights transfer noticication /// 群权转让通知 class GroupRightsTransferNoticication { + /// 群信息 GroupInfo? group; + + /// 操作者信息 GroupMembersInfo? opUser; + + /// 群新的拥有者信息 GroupMembersInfo? newGroupOwner; GroupRightsTransferNoticication({ @@ -298,12 +334,18 @@ class GroupRightsTransferNoticication { } } -/// Mute member notification /// 禁言成员通知 class MuteMemberNotification { + /// 群信息 GroupInfo? group; + + /// 操作者信息 GroupMembersInfo? opUser; + + /// 被禁言的成员信息 GroupMembersInfo? mutedUser; + + /// 禁言时间s int? mutedSeconds; MuteMemberNotification({ @@ -340,11 +382,15 @@ class MuteMemberNotification { } } -/// Burn after reading notification /// 阅后即焚通知 class BurnAfterReadingNotification { + /// 接收者 String? recvID; + + /// 发送者 String? sendID; + + /// 是否开启 bool? isPrivate; BurnAfterReadingNotification({this.recvID, this.sendID, this.isPrivate}); @@ -364,11 +410,15 @@ class BurnAfterReadingNotification { } } -/// Group member info changed notification -/// 禁言成员通知 +/// 群成员信息发送变化通知 class GroupMemberInfoChangedNotification { + /// 群信息 GroupInfo? group; + + /// 操作者信息 GroupMembersInfo? opUser; + + /// 资料发生改变的成员 GroupMembersInfo? changedUser; GroupMemberInfoChangedNotification({ diff --git a/lib/src/models/organization_info.dart b/lib/src/models/organization_info.dart index 9df371d..59af2b6 100644 --- a/lib/src/models/organization_info.dart +++ b/lib/src/models/organization_info.dart @@ -1,14 +1,36 @@ +/// 部门信息 class DeptInfo { + /// 部门id String? departmentID; + + /// 头像 String? faceURL; + + /// 显示名 String? name; + + /// 上一级部门id String? parentID; + + /// 排序方式 int? order; + + /// 部门类型 int? departmentType; + + /// 创建时间 int? createTime; + + /// 子部门数量 int? subDepartmentNum; + + /// 成员数量 int? memberNum; + + /// 扩展字段 String? ex; + + /// 附加信息 String? attachedInfo; DeptInfo( @@ -65,27 +87,63 @@ class DeptInfo { int get hashCode => departmentID.hashCode; } +/// 部门成员信息 class DeptMemberInfo { + /// 用户id String? userID; + + /// 用户昵称 String? nickname; + + /// 英文名 String? englishName; + + /// 头像 String? faceURL; + + /// 性别 int? gender; + + /// 手机号 String? mobile; + + /// 座机 String? telephone; + + /// 出生时间 int? birth; + + /// 邮箱 String? email; + + /// 所在部门的id String? departmentID; + + /// 排序方式 int? order; + + /// 职位 String? position; + + /// int? leader; + + /// 状态 int? status; + + /// 创建时间 int? createTime; + + /// 扩展字段 String? ex; + + /// 附加信息 String? attachedInfo; /// 搜索时使用 String? departmentName; + + /// 所在部门的所有上级部门 List? parentDepartmentList; DeptMemberInfo({ @@ -177,7 +235,10 @@ class DeptMemberInfo { /// 用户所在的部门 class UserInDept { + /// 部门信息 DeptInfo? department; + + /// 所在部门自己的信息 DeptMemberInfo? member; UserInDept({this.department, this.member}); @@ -204,8 +265,13 @@ class UserInDept { /// 部门下的子部门跟员工 class DeptMemberAndSubDept { + /// 一级子部门 List? departmentList; + + /// 一级成员 List? departmentMemberList; + + /// 当前部门的所有上一级部门 List? parentDepartmentList; DeptMemberAndSubDept({ @@ -253,8 +319,12 @@ class DeptMemberAndSubDept { } } +/// 搜索结果 class OrganizationSearchResult { + /// 部门列表 List? departmentList; + + /// 部门成员列表 List? departmentMemberList; OrganizationSearchResult({ diff --git a/lib/src/models/search_info.dart b/lib/src/models/search_info.dart index c5a8a24..6a4067e 100644 --- a/lib/src/models/search_info.dart +++ b/lib/src/models/search_info.dart @@ -3,6 +3,8 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; class SearchResult { /// 获取到的总的消息数量 int? totalCount; + + /// 搜索到的具体内容 List? searchResultItems; SearchResult({this.totalCount, this.searchResultItems}); @@ -34,7 +36,11 @@ class SearchResultItems { /// 会话类型1单聊,2群聊,3,超级大群,4通知会话 int? conversationType; + + /// 显示名 String? showName; + + /// 头像 String? faceURL; /// 搜索到的这个会话下的消息数量 diff --git a/lib/src/models/signaling_info.dart b/lib/src/models/signaling_info.dart index f41dedb..9c53074 100644 --- a/lib/src/models/signaling_info.dart +++ b/lib/src/models/signaling_info.dart @@ -1,8 +1,15 @@ +import 'dart:io'; + import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; class SignalingInfo { + /// 操作者 String? opUserID; + + /// 邀请信息 InvitationInfo? invitation; + + /// 离线显示内容 OfflinePushInfo? offlinePushInfo; SignalingInfo({ @@ -31,15 +38,32 @@ class SignalingInfo { } class InvitationInfo { - String? inviterUserID; //邀请者UserID - List? inviteeUserIDList; //被邀请者UserID列表,如果是单聊只有一个元素 - String? groupID; //如果是单聊,为"" - String? roomID; //房间ID,必须唯一,可以不设置。 - int? timeout; //邀请超时时间(秒) + /// 邀请者UserID + String? inviterUserID; + + /// 被邀请者UserID列表,如果是单聊只有一个元素 + List? inviteeUserIDList; + + /// 如果是单聊,为"" + String? groupID; + + /// 房间ID,必须唯一,可以不设置。 + String? roomID; + + /// 邀请超时时间(秒) + int? timeout; + + /// 发起时间 int? initiateTime; - String? mediaType; //video 或者audio - int? sessionType; //1为单聊,2为群聊 - int? platformID; //和之前定义一致 + + /// video 或者 audio + String? mediaType; + + /// [ConversationType]1为单聊,2为群聊 + int? sessionType; + + /// 平台[Platform] + int? platformID; InvitationInfo( {this.inviterUserID, @@ -79,9 +103,15 @@ class InvitationInfo { } } +/// 信令凭证 class SignalingCertificate { + /// 登录token String? token; + + /// 房间id String? roomID; + + /// 服务器地址 String? liveURL; SignalingCertificate({this.token, this.roomID, this.liveURL}); diff --git a/lib/src/models/user_info.dart b/lib/src/models/user_info.dart index 62b622a..8222518 100644 --- a/lib/src/models/user_info.dart +++ b/lib/src/models/user_info.dart @@ -5,31 +5,52 @@ /// Not a friend is not on the blacklist /// 不是好友不在黑名单 class UserInfo { + /// 用户id String? userID; + + /// 用户昵称 String? nickname; + + /// 头像 String? faceURL; + + /// 性别 int? gender; + + /// 手机号 String? phoneNumber; + + /// 出生时间 int? birth; + + /// 邮箱 String? email; + + /// 扩展字段 String? ex; + + /// 创建时间 int? createTime; + + /// 备注 String? remark; - /// User's public profile(用户公开的资料) + /// 用户公开的资料 PublicUserInfo? publicInfo; - /// Only friends can view information(好友才能查看的资料) + /// 好友才能查看的资料 FriendInfo? friendInfo; - /// blacklist information(黑名单资料) + /// 黑名单资料 BlacklistInfo? blackInfo; + /// 是否好友关系 bool? isFriendship; + /// 是否黑名单 bool? isBlacklist; - /// 全局免打扰 + /// 全局免打扰 0:正常;1:不接受消息;2:接受在线消息不接受离线消息; int? globalRecvMsgOpt; UserInfo({ @@ -165,12 +186,24 @@ class UserInfo { int get hashCode => userID.hashCode; } +/// 公开的资料 class PublicUserInfo { + /// 用户id String? userID; + + /// 昵称 String? nickname; + + /// 头像 String? faceURL; + + /// 性别 int? gender; + + /// int? appMangerLevel; + + /// 扩展信息 String? ex; PublicUserInfo({ @@ -203,18 +236,42 @@ class PublicUserInfo { } } +/// 好友信息 class FriendInfo { + /// 用户id String? userID; + + /// 昵称 String? nickname; + + /// 头像 String? faceURL; + + /// 性别 int? gender; + + /// 手机号 String? phoneNumber; + + /// 出生日期 int? birth; + + /// 邮箱 String? email; + + /// 备注 String? remark; + + /// 扩展字段 String? ex; + + /// 创建时间 int? createTime; + + /// 添加方式 int? addSource; + + /// 操作者id String? operatorUserID; FriendInfo({ @@ -267,14 +324,30 @@ class FriendInfo { } } +/// 黑名单信息 class BlacklistInfo { + /// 用户id String? userID; + + /// 昵称 String? nickname; + + /// 头像 String? faceURL; + + /// 性别 int? gender; + + /// 创建时间 int? createTime; + + /// 添加方式 int? addSource; + + /// 操作者 String? operatorUserID; + + /// 扩展信息 String? ex; BlacklistInfo({ @@ -313,10 +386,11 @@ class BlacklistInfo { } } +/// 关系 class FriendshipInfo { + /// 用户id String? userID; - /// 1 means friend (and not blacklist) /// 1表示好友(并且不是黑名单) int? result; @@ -335,21 +409,51 @@ class FriendshipInfo { } } +/// 好友申请信息 class FriendApplicationInfo { + /// 发起者用户id String? fromUserID; + + /// 发起者用户昵称 String? fromNickname; + + /// 发起者用户头像 String? fromFaceURL; + + /// 发起者性别 int? fromGender; + + /// 接收者用户id String? toUserID; + + /// 接收者用户昵称 String? toNickname; + + /// 接收者头像 String? toFaceURL; + + /// 接收者性别 int? toGender; + + /// 处理结果 int? handleResult; + + /// 请求消息 String? reqMsg; + + /// 创建时间 int? createTime; + + /// 处理者id String? handlerUserID; + + /// 处理备注 String? handleMsg; + + /// 处理时间 int? handleTime; + + /// 扩展字段 String? ex; FriendApplicationInfo( @@ -407,12 +511,12 @@ class FriendApplicationInfo { return data; } - /// friend application waiting handle + /// 等待处理 bool get isWaitingHandle => handleResult == 0; - /// friend application agreed + /// 已同意 bool get isAgreed => handleResult == 1; - /// friend application rejected + /// 已拒绝 bool get isRejected => handleResult == -1; } diff --git a/lib/src/openim.dart b/lib/src/openim.dart index 0c0063f..ce7d144 100644 --- a/lib/src/openim.dart +++ b/lib/src/openim.dart @@ -2,10 +2,11 @@ import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; class OpenIM { - static const MethodChannel _channel = - const MethodChannel('flutter_openim_sdk'); + static const version = '2.1.0'; - static IMManager iMManager = IMManager(_channel); + static const _channel = const MethodChannel('flutter_openim_sdk'); + + static final iMManager = IMManager(_channel); OpenIM._(); } diff --git a/pubspec.yaml b/pubspec.yaml index 3b292f0..be8c128 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_openim_sdk description: An instant messaging plug-in that supports Android and IOS. And the server is also all open source. -version: 2.1.0 +version: 2.1.0+1 homepage: https://www.rentsoft.cn repository: https://github.com/OpenIMSDK/Open-IM-SDK-Flutter