feat: Optimize comments and field names.

This commit is contained in:
std-s
2023-10-12 15:01:38 +08:00
parent cc6d164985
commit 627ee54a67
40 changed files with 1126 additions and 1753 deletions

View File

@@ -9,13 +9,13 @@ class ConversationManager {
ConversationManager(this._channel);
/// 会话监听
/// Conversation Listener
Future setConversationListener(OnConversationListener listener) {
this.listener = listener;
return _channel.invokeMethod('setConversationListener', _buildParam({}));
}
/// 获取所有会话
/// Get All Conversations
Future<List<ConversationInfo>> getAllConversationList(
{String? operationID}) =>
_channel
@@ -27,9 +27,9 @@ class ConversationManager {
.then((value) =>
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
/// 分页获取会话
/// [offset] 开始下标
/// [count] 每页数量
/// Paginate Through Conversations
/// [offset] Starting index
/// [count] Number of items per page
Future<List<ConversationInfo>> getConversationListSplit({
int offset = 0,
int count = 20,
@@ -46,9 +46,9 @@ class ConversationManager {
.then((value) =>
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
/// 查询会话,如果会话不存在会自动生成一个
/// [sourceID] 如果是单聊会话传userID如果是群聊会话传GroupID
/// [sessionType] 参考[ConversationType]
/// Query a Conversation; if it doesn't exist, it will be created
/// [sourceID] UserID for one-on-one conversation, GroupID for group conversation
/// [sessionType] Reference [ConversationType]
Future<ConversationInfo> getOneConversation({
required String sourceID,
required int sessionType,
@@ -65,8 +65,8 @@ class ConversationManager {
.then((value) =>
Utils.toObj(value, (map) => ConversationInfo.fromJson(map)));
/// 根据会话id获取多个会话
/// [conversationIDList] 会话id列表
/// Get Multiple Conversations by Conversation ID
/// [conversationIDList] List of conversation IDs
Future<List<ConversationInfo>> getMultipleConversation({
required List<String> conversationIDList,
String? operationID,
@@ -81,9 +81,9 @@ class ConversationManager {
.then((value) =>
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
/// 设置会话草稿
/// [conversationID] 会话id
/// [draftText] 草稿
/// Set Conversation Draft
/// [conversationID] Conversation ID
/// [draftText] Draft text
Future setConversationDraft({
required String conversationID,
required String draftText,
@@ -97,9 +97,9 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 置顶会话
/// [conversationID] 会话id
/// [isPinned] true置顶false取消置顶
/// Pin a Conversation
/// [conversationID] Conversation ID
/// [isPinned] true: pin, false: unpin
Future pinConversation({
required String conversationID,
required bool isPinned,
@@ -113,8 +113,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 置顶会话
/// [conversationID] 会话id
/// Hide a Conversation
/// [conversationID] Conversation ID
Future hideConversation({
required String conversationID,
String? operationID,
@@ -126,34 +126,31 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 获取未读消息总数
/// int.tryParse(count) ?? 0;
Future<dynamic> getTotalUnreadMsgCount({
String? operationID,
}) =>
/// Get Total Unread Message Count
Future<dynamic> getTotalUnreadMsgCount({String? operationID}) =>
_channel.invokeMethod(
'getTotalUnreadMsgCount',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}));
/// 查询会话id
/// [sourceID] 如果是单聊值传用户ID如果是群聊值传组ID
/// [sessionType] 参考[ConversationType]
// Future<dynamic> getConversationIDBySessionType({
// required String sourceID,
// required int sessionType,
// }) =>
// _channel.invokeMethod(
// 'getConversationIDBySessionType',
// _buildParam({
// "sourceID": sourceID,
// "sessionType": sessionType,
// }));
/// Query Conversation ID
/// [sourceID] UserID for one-on-one, GroupID for group
/// [sessionType] Reference [ConversationType]
Future<dynamic> getConversationIDBySessionType({
required String sourceID,
required int sessionType,
}) =>
_channel.invokeMethod(
'getConversationIDBySessionType',
_buildParam({
"sourceID": sourceID,
"sessionType": sessionType,
}));
/// 消息免打扰设置
/// [conversationID] 会话id
/// [status] 0正常1不接受消息2接受在线消息不接受离线消息
/// Message Do-Not-Disturb Setting
/// [conversationID] Conversation ID
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
Future<dynamic> setConversationRecvMessageOpt({
required String conversationID,
required int status,
@@ -167,9 +164,9 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 查询免打扰状态
/// [conversationIDList] 会话id列表
/// 返回:[{"conversationId":"single_13922222222","result":0}]result0正常1不接受消息2接受在线消息不接受离线消息
/// Query Do-Not-Disturb Status
/// [conversationIDList] List of conversation IDs
/// Returns: [{"conversationId":"single_13922222222","result":0}], result values: 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
Future<List<dynamic>> getConversationRecvMessageOpt({
required List<String> conversationIDList,
String? operationID,
@@ -183,9 +180,9 @@ class ConversationManager {
}))
.then((value) => Utils.toListMap(value));
/// 阅后即焚
/// [conversationID] 会话id
/// [isPrivate] true开启false关闭
/// Self-Destruct Messages
/// [conversationID] Conversation ID
/// [isPrivate] true: enable, false: disable
Future<dynamic> setConversationPrivateChat({
required String conversationID,
required bool isPrivate,
@@ -199,8 +196,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除本地以及服务器的会话
/// [conversationID] 会话ID
/// Delete a Conversation Locally and from the Server
/// [conversationID] Conversation ID
Future<dynamic> deleteConversationAndDeleteAllMsg({
required String conversationID,
String? operationID,
@@ -212,8 +209,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 清空会话里的消息
/// [conversationID] 会话ID
/// Clear Messages in a Conversation
/// [conversationID] Conversation ID
Future<dynamic> clearConversationAndDeleteAllMsg({
required String conversationID,
String? operationID,
@@ -225,7 +222,7 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除所有本地会话
/// Delete All Local Conversations
Future<dynamic> deleteAllConversationFromLocal({
String? operationID,
}) =>
@@ -235,8 +232,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 重置强提醒标识[GroupAtType]
/// [conversationID] 会话id
/// Reset Mentioned (Group At) Flags [GroupAtType]
/// [conversationID] Conversation ID
Future<dynamic> resetConversationGroupAtType({
required String conversationID,
String? operationID,
@@ -248,7 +245,7 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 查询@所有人标识
/// Query @ All Flag
Future<dynamic> getAtAllTag({
String? operationID,
}) =>
@@ -258,11 +255,11 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 查询@所有人标识
/// Get @ All Tag
String get atAllTag => 'AtAllTag';
/// 全局免打扰
/// [status] 0正常1不接受消息2接受在线消息不接受离线消息
/// Global Do-Not-Disturb
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
Future<dynamic> setGlobalRecvMessageOpt({
required int status,
String? operationID,
@@ -274,9 +271,9 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 设置阅后即焚时长
/// [conversationID] 会话id
/// [burnDuration] 时长s默认30s
/// Set Self-Destruct Message Duration
/// [conversationID] Conversation ID
/// [burnDuration] Duration in seconds, default: 30s
Future<dynamic> setConversationBurnDuration({
required String conversationID,
int burnDuration = 30,
@@ -290,9 +287,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 标记消息已读
/// [conversationID] 会话ID
/// [messageIDList] 被标记的消息clientMsgID
/// Mark Messages as Read
/// [conversationID] Conversation ID
Future markConversationMessageAsRead({
required String conversationID,
String? operationID,
@@ -304,8 +300,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 开启定期删除
/// [isMsgDestruct] true 开启
/// Enable Regular Deletion
/// [isMsgDestruct] true: enable
Future<dynamic> setConversationIsMsgDestruct({
required String conversationID,
bool isMsgDestruct = true,
@@ -319,8 +315,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 定期删除聊天记录
/// [duration]
/// Regularly Delete Chat Records
/// [duration] Seconds
Future<dynamic> setConversationMsgDestructTime({
required String conversationID,
int duration = 1 * 24 * 60 * 60,
@@ -334,7 +330,7 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 会话列表自定义排序规则。
/// Custom Sort for Conversation List
List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list
..sort((a, b) {
if ((a.isPinned == true && b.isPinned == true) ||

View File

@@ -7,14 +7,14 @@ class FriendshipManager {
FriendshipManager(this._channel);
/// 好友关系监听
/// Friend Relationship Listener
Future setFriendshipListener(OnFriendshipListener listener) {
this.listener = listener;
return _channel.invokeMethod('setFriendListener', _buildParam({}));
}
/// 查询好友信息
/// [userIDList] userID集合
/// Query Friend Information
/// [userIDList] List of user IDs
Future<List<UserInfo>> getFriendsInfo({
required List<String> userIDList,
String? operationID,
@@ -28,9 +28,9 @@ class FriendshipManager {
}))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// 发送一个好友请求,需要对方调用同意申请才能成为好友。
/// [userID] 被邀请的用户ID
/// [reason] 备注说明
/// Send a Friend Request, the other party needs to accept the request to become friends.
/// [userID] User ID to be invited
/// [reason] Remark description
Future<dynamic> addFriend({
required String userID,
String? reason,
@@ -44,7 +44,7 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 获取别人加我为好友的申请
/// Get Friend Requests Sent to Me
Future<List<FriendApplicationInfo>> getFriendApplicationListAsRecipient(
{String? operationID}) =>
_channel
@@ -56,7 +56,7 @@ class FriendshipManager {
.then((value) =>
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// 获取我发出的好友申请
/// Get Friend Requests Sent by Me
Future<List<FriendApplicationInfo>> getFriendApplicationListAsApplicant(
{String? operationID}) =>
_channel
@@ -68,7 +68,7 @@ class FriendshipManager {
.then((value) =>
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// 获取好友列表,返回的列表包含了已拉入黑名单的好友
/// Get Friend List, including friends who have been put into the blacklist
Future<List<UserInfo>> getFriendList({String? operationID}) => _channel
.invokeMethod(
'getFriendList',
@@ -77,7 +77,7 @@ class FriendshipManager {
}))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// 获取好友列表,返回的列表包含了已拉入黑名单的好友
/// Get Friend List, including friends who have been put into the blacklist (returns a map)
Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel
.invokeMethod(
'getFriendList',
@@ -86,9 +86,9 @@ class FriendshipManager {
}))
.then((value) => Utils.toListMap(value));
/// 设置好友备注
/// [userID] 好友的userID
/// [remark] 好友的备注
/// Set Friend's Remark
/// [userID] Friend's userID
/// [remark] Friend's remark
Future<dynamic> setFriendRemark({
required String userID,
required String remark,
@@ -102,8 +102,8 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 加入黑名单
/// [userID] 被加入黑名单的好友ID
/// Add to Blacklist
/// [userID] Friend's ID to be added to the blacklist
Future<dynamic> addBlacklist({
required String userID,
String? operationID,
@@ -115,7 +115,7 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 获取黑名单列表
/// Get Blacklist
Future<List<UserInfo>> getBlacklist({String? operationID}) => _channel
.invokeMethod(
'getBlacklist',
@@ -124,8 +124,8 @@ class FriendshipManager {
}))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// 从黑名单移除
/// [userID] 用户ID
/// Remove from Blacklist
/// [userID] User ID
Future<dynamic> removeBlacklist({
required String userID,
String? operationID,
@@ -137,8 +137,8 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 检查友好关系
/// [userIDList] userID列表
/// Check Friendship Status
/// [userIDList] List of user IDs
Future<List<FriendshipInfo>> checkFriend({
required List<String> userIDList,
String? operationID,
@@ -153,8 +153,8 @@ class FriendshipManager {
.then((value) =>
Utils.toList(value, (v) => FriendshipInfo.fromJson(v)));
/// 删除好友
/// [userID] 用户ID
/// Delete Friend
/// [userID] User ID
Future<dynamic> deleteFriend({
required String userID,
String? operationID,
@@ -166,9 +166,9 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 接受好友请求
/// [userID] 用户ID
/// [handleMsg]备注说明
/// Accept Friend Request
/// [userID] User ID
/// [handleMsg] Remark description
Future<dynamic> acceptFriendApplication({
required String userID,
String? handleMsg,
@@ -182,9 +182,9 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 拒绝好友请求
/// [userID] 用户ID
/// [handleMsg]备注说明
/// Reject Friend Request
/// [userID] User ID
/// [handleMsg] Remark description
Future<dynamic> refuseFriendApplication({
required String userID,
String? handleMsg,
@@ -198,11 +198,11 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 查好友
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空
/// [isSearchUserID] 是否以关键词搜索好友ID(注不可以同时为false)为空默认false
/// [isSearchNickname] 是否以关键词搜索昵称为空默认false
/// [isSearchRemark] 是否以关键词搜索备注名为空默认false
/// Search for Friends
/// [keywordList] Search keywords, currently supports only one keyword search, cannot be empty
/// [isSearchUserID] Whether to search for friend IDs with keywords (note: cannot be false at the same time), defaults to false if empty
/// [isSearchNickname] Whether to search by nickname with keywords, defaults to false if empty
/// [isSearchRemark] Whether to search by remark name with keywords, defaults to false if empty
Future<List<FriendInfo>> searchFriends({
List<String> keywordList = const [],
bool isSearchUserID = false,

View File

@@ -9,15 +9,15 @@ class GroupManager {
GroupManager(this._channel);
/// 组关系监听
/// Group relationship listener
Future setGroupListener(OnGroupListener listener) {
this.listener = listener;
return _channel.invokeMethod('setGroupListener', _buildParam({}));
}
/// 邀请进组,直接进组无需同意。
/// [groupID] ID
/// [userIDList] 用户ID列表
/// Invite users to a group, allowing them to join without approval.
/// [groupID] Group ID
/// [userIDList] List of user IDs
Future<List<GroupInviteResult>> inviteUserToGroup({
required String groupID,
required List<String> userIDList,
@@ -33,13 +33,12 @@ class GroupManager {
'reason': reason,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
/// 移除组成员
/// [groupID] ID
/// [userIDList] 用户ID列表
/// [reason] 备注说明
/// Remove group members
/// [groupID] Group ID
/// [userIDList] List of user IDs
/// [reason] Reason for removal
Future<List<GroupInviteResult>> kickGroupMember({
required String groupID,
required List<String> userIDList,
@@ -55,12 +54,11 @@ class GroupManager {
'reason': reason,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
/// 查询组成员资料
/// [groupID] ID
/// [userIDList] 用户ID列表
/// Query group member information
/// [groupID] Group ID
/// [userIDList] List of user IDs
Future<List<GroupMembersInfo>> getGroupMembersInfo({
required String groupID,
required List<String> userIDList,
@@ -74,14 +72,13 @@ class GroupManager {
'userIDList': userIDList,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 分页获取组成员列表
/// [groupID] ID
/// [filter] 过滤成员 0所有1群主 , 2管理员3普通成员4管理员+普通成员 5,群主+管理员
/// [offset] 开始下标
/// [count] 总数
/// Paginate and retrieve the group member list
/// [groupID] Group ID
/// [filter] Member filter (0: All, 1: Group owner, 2: Administrator, 3: Regular member, 4: Admin + Regular member, 5: Group owner + Admin)
/// [offset] Starting index
/// [count] Total count
Future<List<GroupMembersInfo>> getGroupMemberList({
required String groupID,
int filter = 0,
@@ -99,14 +96,13 @@ class GroupManager {
'count': count,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 分页获取组成员列表
/// [groupID] ID
/// [filter] 过滤成员 0所有1群主 , 2管理员3普通成员4管理员+普通成员 5,群主+管理员
/// [offset] 开始下标
/// [count] 总数
/// Paginate and retrieve the group member list as a map
/// [groupID] Group ID
/// [filter] Member filter (0: All, 1: Group owner, 2: Administrator, 3: Regular member, 4: Admin + Regular member, 5: Group owner + Admin)
/// [offset] Starting index
/// [count] Total count
Future<List<dynamic>> getGroupMemberListMap({
required String groupID,
int filter = 0,
@@ -126,7 +122,7 @@ class GroupManager {
}))
.then((value) => Utils.toListMap(value));
/// 查询已加入的组列表
/// Query the list of joined groups
Future<List<GroupInfo>> getJoinedGroupList({String? operationID}) => _channel
.invokeMethod(
'getJoinedGroupList',
@@ -135,7 +131,7 @@ class GroupManager {
}))
.then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// 查询已加入的组列表
/// Query the list of joined groups
Future<List<dynamic>> getJoinedGroupListMap({String? operationID}) => _channel
.invokeMethod(
'getJoinedGroupList',
@@ -144,8 +140,8 @@ class GroupManager {
}))
.then((value) => Utils.toListMap(value));
/// 检查是否已加入组
/// [groupID] ID
/// Check if the user has joined a group
/// [groupID] Group ID
Future<bool> isJoinedGroup({
required String groupID,
String? operationID,
@@ -159,14 +155,11 @@ class GroupManager {
}))
.then((value) => value == 'true' ? true : false);
/// 创建一个组
/// [groupName] 群名
/// [notification] 公告
/// [introduction] 群介绍
/// [faceUrl] 群头像
/// [groupType] 组类型 [GroupType]
/// [ex] 额外信息
/// [list] 初创群成员以及其角色列表[GroupMemberRole]
/// Create a new group
/// [groupInfo] Group information
/// [memberUserIDs] List of user IDs to add as initial members
/// [adminUserIDs] List of user IDs to add as administrators
/// [ownerUserID] User ID of the owner
Future<GroupInfo> createGroup({
required GroupInfo groupInfo,
List<String> memberUserIDs = const [],
@@ -184,16 +177,9 @@ class GroupManager {
'ownerUserID': ownerUserID,
'operationID': Utils.checkOperationID(operationID),
}))
.then(
(value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map)));
.then((value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map)));
/// 编辑组资料
/// [groupID] 被编辑的群ID
/// [groupName] 新的群名
/// [notification] 新的公告
/// [introduction] 新的群介绍
/// [faceURL] 新的群头像
/// [ex] 新的额外信息
/// Edit group information
Future<dynamic> setGroupInfo({
required String groupID,
String? groupName,
@@ -223,8 +209,7 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 查询组信息
/// [groupIDList] 组ID列表
/// Query group information
Future<List<GroupInfo>> getGroupsInfo({
required List<String> groupIDList,
String? operationID,
@@ -236,11 +221,10 @@ class GroupManager {
'groupIDList': groupIDList,
'operationID': Utils.checkOperationID(operationID),
}))
.then(
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// 申请加入组,需要通过管理员/群组同意。
/// [joinSource] 2:通过邀请 3通过搜索 4通过二维码
/// Apply to join a group, requiring approval from an administrator or the group.
/// [joinSource] 2: Invited, 3: Searched, 4: Using a QR code
Future<dynamic> joinGroup({
required String groupID,
String? reason,
@@ -256,7 +240,7 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 退出组
/// Exit a group
Future<dynamic> quitGroup({
required String groupID,
String? operationID,
@@ -268,9 +252,9 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 转移组拥有者权限
/// [groupID] 组ID
/// [userID] 新拥有者ID
// (Continuing the code)
/// Transfer group ownership
Future<dynamic> transferGroupOwner({
required String groupID,
required String userID,
@@ -284,34 +268,26 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 作为群主或者管理员,收到的群成员入群申请
Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient(
{String? operationID}) =>
_channel
.invokeMethod(
'getGroupApplicationListAsRecipient',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
/// Handle group membership applications received as a group owner or administrator
Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient({String? operationID}) => _channel
.invokeMethod(
'getGroupApplicationListAsRecipient',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
/// 获取自己发出的入群申请记录
Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant(
{String? operationID}) =>
_channel
.invokeMethod(
'getGroupApplicationListAsApplicant',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
/// Get the list of group membership applications sent by the user
Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant({String? operationID}) => _channel
.invokeMethod(
'getGroupApplicationListAsApplicant',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
/// 管理员或者群主同意某人进入某群
/// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理
/// [groupID] 组id
/// [userID] 申请者用户ID
/// Accept a group membership application as an administrator or group owner
/// Note: Membership applications require approval from administrators or the group.
Future<dynamic> acceptGroupApplication({
required String groupID,
required String userID,
@@ -327,11 +303,8 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 管理员或者群主拒绝某人进入某群
/// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理
/// [groupID] 组id
/// [userID] 申请者用户ID
/// [handleMsg] 说明
/// Refuse a group membership application as an administrator or group owner
/// Note: Membership applications require approval from administrators or the group.
Future<dynamic> refuseGroupApplication({
required String groupID,
required String userID,
@@ -347,8 +320,10 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 解散群
/// [groupID] 群ID
// (Continuing the code)
/// Dissolve a group
/// [groupID] Group ID
Future<dynamic> dismissGroup({
required String groupID,
String? operationID,
@@ -360,9 +335,9 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 开启群禁言,所有群成员禁止发言
/// [groupID] 将开启群禁言的组ID
/// [mute] true开启false关闭
/// Enable or disable group mute, preventing all group members from sending messages
/// [groupID] Group ID
/// [mute] true: Enable, false: Disable
Future<dynamic> changeGroupMute({
required String groupID,
required bool mute,
@@ -376,10 +351,10 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 禁言群成员
/// [groupID] ID
/// [userID] 将被禁言的成员ID
/// [seconds] 被禁言的时间s设置为0则为解除禁言
/// Mute a group member
/// [groupID] Group ID
/// [userID] Member ID to mute
/// [seconds] Duration of the mute in seconds (set to 0 to unmute)
Future<dynamic> changeGroupMemberMute({
required String groupID,
required String userID,
@@ -395,10 +370,10 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 设置群成员昵称
/// [groupID] ID
/// [userID] 群成员的用户ID
/// [groupNickname] 群昵称
/// Set the nickname of a group member
/// [groupID] Group ID
/// [userID] User ID of the group member
/// [groupNickname] Group nickname
Future<dynamic> setGroupMemberNickname({
required String groupID,
required String userID,
@@ -414,10 +389,10 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 查询群
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空
/// [isSearchGroupID] 是否以关键词搜索群ID(注两个不可以同时为false)为空默认false
/// [isSearchGroupName] 是否以关键词搜索群名字为空默认false
/// Query a group
/// [keywordList] Search keywords; currently, only one keyword is supported, and it cannot be empty.
/// [isSearchGroupID] Whether to search by group ID (Note: cannot set both to false at the same time); defaults to false if not set.
/// [isSearchGroupName] Whether to search by group name; defaults to false if not set.
Future<List<GroupInfo>> searchGroups({
List<String> keywordList = const [],
bool isSearchGroupID = false,
@@ -435,13 +410,12 @@ class GroupManager {
},
'operationID': Utils.checkOperationID(operationID),
}))
.then(
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// 设置群成员权限
/// [groupID] ID
/// [userID] 群成员的用户ID
/// [roleLevel] 角色等级,参考[GroupRoleLevel]
/// Set group member role
/// [groupID] Group ID
/// [userID] User ID of the group member
/// [roleLevel] Role level; see [GroupRoleLevel]
Future<dynamic> setGroupMemberRoleLevel({
required String groupID,
required String userID,
@@ -457,13 +431,7 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 根据加入时间分页获取组成员列表
/// [groupID] 群ID
/// [joinTimeBegin] 加入开始时间
/// [joinTimeEnd] 加入结束时间
/// [offset] 开始下标
/// [count] 总数
/// [excludeUserIDList] 排除的用户
/// Get a group member list based on join time
Future<List<GroupMembersInfo>> getGroupMemberListByJoinTime({
required String groupID,
int offset = 0,
@@ -485,12 +453,11 @@ class GroupManager {
'excludeUserIDList': excludeUserIDList,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 进群验证设置
/// [groupID] ID
/// [needVerification] 进群设置,参考[GroupVerification]
/// Set group verification for joining
/// [groupID] Group ID
/// [needVerification] Verification setting; see [GroupVerification] class
Future<dynamic> setGroupVerification({
required String groupID,
required int needVerification,
@@ -504,9 +471,9 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 不允许通过群获取成员资料
/// [groupID] ID
/// [status] 0关闭1打开
/// Allow/disallow members to view each other's information through the group
/// [groupID] Group ID
/// [status] 0: Disable, 1: Enable
Future<dynamic> setGroupLookMemberInfo({
required String groupID,
required int status,
@@ -520,9 +487,9 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 不允许通过群添加好友
/// [groupID] ID
/// [status] 0关闭1打开
/// Allow/disallow members to add friends through the group
/// [groupID] Group ID
/// [status] 0: Disable, 1: Enable
Future<dynamic> setGroupApplyMemberFriend({
required String groupID,
required int status,
@@ -536,8 +503,8 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 获取群拥有者,管理员
/// [groupId] ID
/// Get group owners and administrators
/// [groupId] Group ID
Future<List<GroupMembersInfo>> getGroupOwnerAndAdmin({
required String groupID,
String? operationID,
@@ -549,16 +516,15 @@ class GroupManager {
'groupID': groupID,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 查询群
/// [groupID] 群id
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空
/// [isSearchUserID] 是否以关键词搜成员id
/// [isSearchMemberNickname] 是否以关键词搜索成员昵称
/// [offset] 开始index
/// [count] 每次获取的总数
/// Search for group members
/// [groupID] Group ID
/// [keywordList] Search keywords; currently, only one keyword is supported, and it cannot be empty.
/// [isSearchUserID] Whether to search by member ID
/// [isSearchMemberNickname] Whether to search by member nickname
/// [offset] Start index
/// [count] Total count to retrieve
Future<List<GroupMembersInfo>> searchGroupMembers({
required String groupID,
List<String> keywordList = const [],
@@ -582,16 +548,15 @@ class GroupManager {
},
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 查询群
/// [groupID] 群id
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空
/// [isSearchUserID] 是否以关键词搜成员id
/// [isSearchMemberNickname] 是否以关键词搜索成员昵称
/// [offset] 开始index
/// [count] 每次获取的总数
/// Query a group
/// [groupID] Group ID
/// [keywordList] Search keyword, currently only supports searching with one keyword, and it cannot be empty
/// [isSearchUserID] Whether to search member IDs with the keyword
/// [isSearchMemberNickname] Whether to search member nicknames with the keyword
/// [offset] Starting index
/// [count] Total number to retrieve each time
Future<List<dynamic>> searchGroupMembersListMap({
required String groupID,
List<String> keywordList = const [],
@@ -617,7 +582,7 @@ class GroupManager {
}))
.then((value) => Utils.toListMap(value));
/// 修改GroupMemberInfo ex字段
/// Modify the GroupMemberInfo ex field
Future<dynamic> setGroupMemberInfo({
required String groupID,
required String userID,
@@ -634,7 +599,6 @@ class GroupManager {
},
'operationID': Utils.checkOperationID(operationID),
}));
static Map _buildParam(Map param) {
param["ManagerName"] = "groupManager";
log('param: $param');

View File

@@ -64,8 +64,9 @@ class IMManager {
userManager.listener.selfInfoUpdated(userInfo);
break;
case 'onUserStatusChanged':
final status = Utils.toObj(data, (map) => UserStatusInfo.fromJson(map));
userManager.listener.userStatusChanged(status);
final status =
Utils.toObj(data, (map) => UserStatusInfo.fromJson(map));
userManager.listener.userStatusChanged(status);
break;
}
} else if (call.method == ListenerType.groupListener) {
@@ -73,19 +74,23 @@ class IMManager {
dynamic data = call.arguments['data'];
switch (type) {
case 'onGroupApplicationAccepted':
final i = Utils.toObj(data, (map) => GroupApplicationInfo.fromJson(map));
final i = Utils.toObj(
data, (map) => GroupApplicationInfo.fromJson(map));
groupManager.listener.groupApplicationAccepted(i);
break;
case 'onGroupApplicationAdded':
final i = Utils.toObj(data, (map) => GroupApplicationInfo.fromJson(map));
final i = Utils.toObj(
data, (map) => GroupApplicationInfo.fromJson(map));
groupManager.listener.groupApplicationAdded(i);
break;
case 'onGroupApplicationDeleted':
final i = Utils.toObj(data, (map) => GroupApplicationInfo.fromJson(map));
final i = Utils.toObj(
data, (map) => GroupApplicationInfo.fromJson(map));
groupManager.listener.groupApplicationDeleted(i);
break;
case 'onGroupApplicationRejected':
final i = Utils.toObj(data, (map) => GroupApplicationInfo.fromJson(map));
final i = Utils.toObj(
data, (map) => GroupApplicationInfo.fromJson(map));
groupManager.listener.groupApplicationRejected(i);
break;
case 'onGroupDismissed':
@@ -97,15 +102,18 @@ class IMManager {
groupManager.listener.groupInfoChanged(i);
break;
case 'onGroupMemberAdded':
final i = Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
final i =
Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
groupManager.listener.groupMemberAdded(i);
break;
case 'onGroupMemberDeleted':
final i = Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
final i =
Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
groupManager.listener.groupMemberDeleted(i);
break;
case 'onGroupMemberInfoChanged':
final i = Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
final i =
Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
groupManager.listener.groupMemberInfoChanged(i);
break;
case 'onJoinedGroupAdded':
@@ -133,31 +141,22 @@ class IMManager {
break;
case 'onRecvC2CReadReceipt':
var value = call.arguments['data']['msgReceiptList'];
var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
var list =
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
messageManager.msgListener.recvC2CReadReceipt(list);
break;
case 'onRecvGroupReadReceipt':
var value = call.arguments['data']['groupMsgReceiptList'];
var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
var list =
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
messageManager.msgListener.recvGroupReadReceipt(list);
break;
case 'onRecvMessageExtensionsAdded':
var msgID = call.arguments['data']['msgID'];
var value = call.arguments['data']['reactionExtensionList'];
var list = Utils.toList(value, (map) => KeyValue.fromJson(map));
messageManager.msgListener.recvMessageExtensionsAdded(msgID, list);
break;
case 'onRecvMessageExtensionsChanged':
var msgID = call.arguments['data']['msgID'];
var value = call.arguments['data']['reactionExtensionList'];
var list = Utils.toList(value, (map) => KeyValue.fromJson(map));
messageManager.msgListener.recvMessageExtensionsChanged(msgID, list);
break;
case 'onRecvMessageExtensionsDeleted':
var msgID = call.arguments['data']['msgID'];
var value = call.arguments['data']['reactionExtensionKeyList'];
var list = Utils.toList(value, (map) => '$map');
messageManager.msgListener.recvMessageExtensionsDeleted(msgID, list);
messageManager.msgListener
.recvMessageExtensionsDeleted(msgID, list);
break;
case 'onRecvNewMessage':
@@ -199,15 +198,18 @@ class IMManager {
conversationManager.listener.syncServerFailed();
break;
case 'onNewConversation':
var list = Utils.toList(data, (map) => ConversationInfo.fromJson(map));
var list =
Utils.toList(data, (map) => ConversationInfo.fromJson(map));
conversationManager.listener.newConversation(list);
break;
case 'onConversationChanged':
var list = Utils.toList(data, (map) => ConversationInfo.fromJson(map));
var list =
Utils.toList(data, (map) => ConversationInfo.fromJson(map));
conversationManager.listener.conversationChanged(list);
break;
case 'onTotalUnreadMessageCountChanged':
conversationManager.listener.totalUnreadMessageCountChanged(data ?? 0);
conversationManager.listener
.totalUnreadMessageCountChanged(data ?? 0);
break;
}
} else if (call.method == ListenerType.friendListener) {
@@ -228,19 +230,23 @@ class IMManager {
friendshipManager.listener.friendAdded(u);
break;
case 'onFriendApplicationAccepted':
final u = Utils.toObj(data, (map) => FriendApplicationInfo.fromJson(map));
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
friendshipManager.listener.friendApplicationAccepted(u);
break;
case 'onFriendApplicationAdded':
final u = Utils.toObj(data, (map) => FriendApplicationInfo.fromJson(map));
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
friendshipManager.listener.friendApplicationAdded(u);
break;
case 'onFriendApplicationDeleted':
final u = Utils.toObj(data, (map) => FriendApplicationInfo.fromJson(map));
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
friendshipManager.listener.friendApplicationDeleted(u);
break;
case 'onFriendApplicationRejected':
final u = Utils.toObj(data, (map) => FriendApplicationInfo.fromJson(map));
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
friendshipManager.listener.friendApplicationRejected(u);
break;
case 'onFriendDeleted':
@@ -257,16 +263,8 @@ class IMManager {
String data = call.arguments['data'];
switch (type) {
case 'onRecvCustomBusinessMessage':
messageManager.customBusinessListener?.recvCustomBusinessMessage(data);
break;
}
} else if (call.method == ListenerType.messageKvInfoListener) {
String type = call.arguments['type'];
String data = call.arguments['data'];
switch (type) {
case 'onMessageKvInfoChanged':
final list = Utils.toList(data, (map) => MessageKv.fromJson(map)).toList();
messageManager.messageKvInfoListener?.messageKvInfoChanged(list);
messageManager.customBusinessListener
?.recvCustomBusinessMessage(data);
break;
}
} else if (call.method == ListenerType.listenerForService) {
@@ -274,19 +272,23 @@ class IMManager {
String data = call.arguments['data'];
switch (type) {
case 'onFriendApplicationAccepted':
final u = Utils.toObj(data, (map) => FriendApplicationInfo.fromJson(map));
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
_listenerForService?.friendApplicationAccepted(u);
break;
case 'onFriendApplicationAdded':
final u = Utils.toObj(data, (map) => FriendApplicationInfo.fromJson(map));
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
_listenerForService?.friendApplicationAdded(u);
break;
case 'onGroupApplicationAccepted':
final i = Utils.toObj(data, (map) => GroupApplicationInfo.fromJson(map));
final i = Utils.toObj(
data, (map) => GroupApplicationInfo.fromJson(map));
_listenerForService?.groupApplicationAccepted(i);
break;
case 'onGroupApplicationAdded':
final i = Utils.toObj(data, (map) => GroupApplicationInfo.fromJson(map));
final i = Utils.toObj(
data, (map) => GroupApplicationInfo.fromJson(map));
_listenerForService?.groupApplicationAdded(i);
break;
case 'onRecvNewMessage':
@@ -334,7 +336,8 @@ class IMManager {
int fileSize = data['fileSize'];
int streamSize = data['streamSize'];
int storageSize = data['storageSize'];
_uploadFileListener?.uploadProgress(id, fileSize, streamSize, storageSize);
_uploadFileListener?.uploadProgress(
id, fileSize, streamSize, storageSize);
break;
case 'uploadID':
String id = data['id'];
@@ -346,26 +349,28 @@ class IMManager {
int index = data['index'];
int partSize = data['partSize'];
String partHash = data['partHash'];
_uploadFileListener?.uploadPartComplete(id, index, partSize, partHash);
_uploadFileListener?.uploadPartComplete(
id, index, partSize, partHash);
break;
}
}
} catch (error, stackTrace) {
Logger.print("回调失败了。${call.method} ${call.arguments['type']} ${call.arguments['data']} $error $stackTrace");
Logger.print(
"回调失败了。${call.method} ${call.arguments['type']} ${call.arguments['data']} $error $stackTrace");
}
return Future.value(null);
});
}
/// 初始化SDK
/// [platform] 平台编号[IMPlatform]
/// [apiAddr] SDK api地址
/// [wsAddr] SDK websocket地址
/// [dataDir] SDK数据库存储目录
/// [objectStorage] 存储对象 cos/minio
/// [logLevel] 日志 1不打印
/// [enabledEncryption] true:加密
/// [enabledCompression] true:压缩
/// Initialize the SDK
/// [platform] Platform ID [IMPlatform]
/// [apiAddr] SDK API address
/// [wsAddr] SDK WebSocket address
/// [dataDir] SDK database storage directory
/// [objectStorage] Object storage minio
/// [logLevel] Log level, 1: no printing
/// [enabledEncryption] true: encryption
/// [enabledCompression] true: compression
Future<dynamic> initSDK({
required int platformID,
required String apiAddr,
@@ -373,46 +378,41 @@ class IMManager {
required String dataDir,
required OnConnectListener listener,
int logLevel = 6,
String objectStorage = 'cos',
// String? encryptionKey,
// bool isNeedEncryption = false,
// bool isCompression = false,
// bool isExternalExtensions = false,
String objectStorage = 'minio',
bool isCompression = false,
bool isLogStandardOutput = true,
String? logFilePath,
String? operationID,
}) {
this._connectListener = listener;
return _channel.invokeMethod(
'initSDK',
_buildParam(
{
"platformID": platformID,
"apiAddr": apiAddr,
"wsAddr": wsAddr,
"dataDir": dataDir,
"logLevel": logLevel,
"objectStorage": objectStorage,
// "encryptionKey": encryptionKey,
// "isNeedEncryption": isNeedEncryption,
// "isCompression": isCompression,
// "isExternalExtensions": isExternalExtensions,
"isLogStandardOutput": isLogStandardOutput,
"logFilePath": logFilePath,
"operationID": Utils.checkOperationID(operationID),
},
));
'initSDK',
_buildParam(
{
"platformID": platformID,
"apiAddr": apiAddr,
"wsAddr": wsAddr,
"dataDir": dataDir,
"logLevel": logLevel,
"objectStorage": objectStorage,
"isCompression": isCompression,
"isLogStandardOutput": isLogStandardOutput,
"logFilePath": logFilePath,
"operationID": Utils.checkOperationID(operationID),
},
),
);
}
/// 反初始化SDK
/// Deinitialize the SDK
Future<dynamic> unInitSDK() {
return _channel.invokeMethod('unInitSDK', _buildParam({}));
}
/// 登录
/// [userID] 用户id
/// [token] 登录token从业务服务器上获取
/// [defaultValue] 获取失败后使用的默认值
/// Login
/// [userID] User ID
/// [token] Login token obtained from the business server
/// [defaultValue] Default value to use if login fails
Future<UserInfo> login({
required String userID,
required String token,
@@ -422,7 +422,7 @@ class IMManager {
}) async {
int? status;
if (checkLoginStatus) {
// 1: logout 2: logging 3:logged
// 1: logout 2: logging 3: logged
status = await getLoginStatus();
}
if (status != LoginStatus.logging && status != LoginStatus.logged) {
@@ -450,36 +450,38 @@ class IMManager {
// return uInfo;
}
/// 登出
/// Logout
Future<dynamic> logout({String? operationID}) async {
var value = await _channel.invokeMethod(
'logout',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}));
'logout',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}),
);
this.isLogined = false;
this.token = null;
return value;
}
/// 获取登录状态
/// 1: logout 2: logging 3:logged
/// Get login status
/// 1: logout 2: logging 3: logged
Future<int?> getLoginStatus({
String? operationID,
}) =>
_channel.invokeMethod<int>(
'getLoginStatus',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}));
'getLoginStatus',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}),
);
/// 获取当前登录用户id
/// Get the current logged-in user ID
Future<String> getLoginUserID() async => userID;
/// 获取当前登录用户信息
/// Get the current logged-in user information
Future<UserInfo> getLoginUserInfo() async => userInfo;
///[id] [OnUploadFileListener] id一致区分是哪个文件的回调
/// [id] Same as [OnUploadFileListener] ID, to distinguish which file callback it is
Future uploadFile({
required String id,
required String filePath,
@@ -489,50 +491,30 @@ class IMManager {
String? operationID,
}) =>
_channel.invokeMethod(
'uploadFile',
_buildParam({
'id': id,
'filePath': filePath,
'name': fileName,
'contentType': contentType,
'cause': cause,
'operationID': Utils.checkOperationID(operationID),
}));
'uploadFile',
_buildParam({
'id': id,
'filePath': filePath,
'name': fileName,
'contentType': contentType,
'cause': cause,
'operationID': Utils.checkOperationID(operationID),
}),
);
/// 更新firebase客户端注册token
/// [fcmToken] firebase token
/// Update the Firebase client registration token
/// [fcmToken] Firebase token
Future updateFcmToken({
required String fcmToken,
String? operationID,
}) =>
_channel.invokeMethod(
'updateFcmToken',
_buildParam({
'fcmToken': fcmToken,
'operationID': Utils.checkOperationID(operationID),
}));
/// 标记app处于后台
// Future setAppBackgroundStatus({
// required bool isBackground,
// String? operationID,
// }) =>
// _channel.invokeMethod(
// 'setAppBackgroundStatus',
// _buildParam({
// 'isBackground': isBackground,
// 'operationID': Utils.checkOperationID(operationID),
// }));
/// 网络改变
// Future networkStatusChanged({
// String? operationID,
// }) =>
// _channel.invokeMethod(
// 'networkStatusChanged',
// _buildParam({
// 'operationID': Utils.checkOperationID(operationID),
// }));
'updateFcmToken',
_buildParam({
'fcmToken': fcmToken,
'operationID': Utils.checkOperationID(operationID),
}),
);
void setUploadFileListener(OnUploadFileListener listener) {
_uploadFileListener = listener;

View File

@@ -4,15 +4,13 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class MessageManager {
MethodChannel _channel;
// List<AdvancedMsgListener> advancedMsgListeners = List.empty(growable: true);
OnMsgSendProgressListener? msgSendProgressListener;
late OnAdvancedMsgListener msgListener;
OnCustomBusinessListener? customBusinessListener;
OnMessageKvInfoListener? messageKvInfoListener;
MessageManager(this._channel);
/// 消息监听
/// Message listener
Future setAdvancedMsgListener(OnAdvancedMsgListener listener) {
this.msgListener = listener;
// advancedMsgListeners.add(listener);
@@ -23,16 +21,16 @@ class MessageManager {
}));
}
/// 消息发送进度监听
/// Message send progress listener
void setMsgSendProgressListener(OnMsgSendProgressListener listener) {
msgSendProgressListener = listener;
}
/// 发送消息
/// [message] 消息体
/// [userID] 接收消息的用户id
/// [groupID] 接收消息的组id
/// [offlinePushInfo] 离线消息显示内容
/// Send a message
/// [message] Message content
/// [userID] User ID of the recipient
/// [groupID] Group ID of the recipient
/// [offlinePushInfo] Offline message display content
Future<Message> sendMessage({
required Message message,
required OfflinePushInfo offlinePushInfo,
@@ -52,8 +50,8 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 删除本地消息
/// [message] 被删除的消息体
/// Delete a message from local storage
/// [message] Message to be deleted
Future deleteMessageFromLocalStorage({
required String conversationID,
required String clientMsgID,
@@ -68,8 +66,8 @@ class MessageManager {
}));
/// core-sdk: DeleteMessage
/// 删除本地跟服务器的指定的消息
/// [message] 被删除的消息
/// Delete a specified message from local and server
/// [message] Message to be deleted
Future<dynamic> deleteMessageFromLocalAndSvr({
required String conversationID,
required String clientMsgID,
@@ -83,7 +81,7 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除本地所有聊天记录
/// Delete all local chat records
Future<dynamic> deleteAllMsgFromLocal({
String? operationID,
}) =>
@@ -93,7 +91,7 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除本地跟服务器所有聊天记录
/// Delete all chat records from local and server
Future<dynamic> deleteAllMsgFromLocalAndSvr({
String? operationID,
}) =>
@@ -103,10 +101,10 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 插入单聊消息到本地
/// [receiverID] 接收者id
/// [senderID] 发送者id
/// [message] 消息体
/// Insert a single chat message into local storage
/// [receiverID] Receiver's ID
/// [senderID] Sender's ID
/// [message] Message content
Future<Message> insertSingleMessageToLocalStorage({
String? receiverID,
String? senderID,
@@ -124,10 +122,10 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 插入群聊消息到本地
/// [groupID] 群id
/// [senderID] 发送者id
/// [message] 消息体
/// Insert a group chat message into local storage
/// [groupID] Group ID
/// [senderID] Sender's ID
/// [message] Message content
Future<Message> insertGroupMessageToLocalStorage({
String? groupID,
String? senderID,
@@ -145,8 +143,8 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 正在输入提示
/// [msgTip] 自定义内容
/// Typing status update
/// [msgTip] Custom content
Future typingStatusUpdate({
required String userID,
String? msgTip,
@@ -160,7 +158,7 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 创建文本消息
/// Create a text message
Future<Message> createTextMessage({
required String text,
String? operationID,
@@ -174,11 +172,11 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建@消息
/// [text] 输入内容
/// [atUserIDList] 被@到的userID集合
/// [atUserInfoList] userIDnickname映射关系用在界面显示时将id替换为nickname
/// [quoteMessage] 引用消息(被回复的消息)
/// Create an @ message
/// [text] Input content
/// [atUserIDList] Collection of userIDs being mentioned
/// [atUserInfoList] Mapping of userID to nickname, used for displaying nicknames instead of IDs in the user interface
/// [quoteMessage] Quoted message (the message being replied to)
Future<Message> createTextAtMessage({
required String text,
required List<String> atUserIDList,
@@ -199,8 +197,8 @@ class MessageManager {
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建图片消息
/// [imagePath] 路径
/// Create an image message
/// [imagePath] Path
Future<Message> createImageMessage({
required String imagePath,
String? operationID,
@@ -215,8 +213,8 @@ class MessageManager {
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建图片消息
/// [imagePath] 路径
/// Create an image message from a full path
/// [imagePath] Path
Future<Message> createImageMessageFromFullPath({
required String imagePath,
String? operationID,
@@ -231,9 +229,9 @@ class MessageManager {
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建语音消息
/// [soundPath] 路径
/// [duration] 时长s
/// Create a sound message
/// [soundPath] Path
/// [duration] Duration in seconds
Future<Message> createSoundMessage({
required String soundPath,
required int duration,
@@ -250,9 +248,9 @@ class MessageManager {
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建语音消息
/// [soundPath] 路径
/// [duration] 时长s
/// Create a sound message from a full path
/// [soundPath] Path
/// [duration] Duration in seconds
Future<Message> createSoundMessageFromFullPath({
required String soundPath,
required int duration,
@@ -269,11 +267,11 @@ class MessageManager {
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息
/// [videoPath] 路径
/// [videoType] 视频mime类型
/// [duration] 时长s
/// [snapshotPath] 默认站位图路径
/// Create a video message
/// [videoPath] Path
/// [videoType] Video MIME type
/// [duration] Duration in seconds
/// [snapshotPath] Default snapshot image path
Future<Message> createVideoMessage({
required String videoPath,
required String videoType,
@@ -293,11 +291,11 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息
/// [videoPath] 路径
/// [videoType] 视频mime类型
/// [duration] 时长s
/// [snapshotPath] 默认站位图路径
/// Create a video message from a full path
/// [videoPath] Path
/// [videoType] Video MIME type
/// [duration] Duration in seconds
/// [snapshotPath] Default snapshot image path
Future<Message> createVideoMessageFromFullPath({
required String videoPath,
required String videoType,
@@ -317,9 +315,9 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建文件消息
/// [filePath] 路径
/// [fileName] 文件名
/// Create a file message
/// [filePath] Path
/// [fileName] File name
Future<Message> createFileMessage({
required String filePath,
required String fileName,
@@ -336,9 +334,9 @@ class MessageManager {
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
}
/// 创建文件消息
/// [filePath] 路径
/// [fileName] 文件名
/// Create a file message from a full path
/// [filePath] Path
/// [fileName] File name
Future<Message> createFileMessageFromFullPath({
required String filePath,
required String fileName,
@@ -354,10 +352,10 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建合并消息
/// [messageList] 被选中的消息
/// [title] 摘要标题
/// [summaryList] 摘要内容
/// Create a merged message
/// [messageList] Selected messages
/// [title] Summary title
/// [summaryList] Summary content
Future<Message> createMergerMessage({
required List<Message> messageList,
required String title,
@@ -375,8 +373,8 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建转发消息
/// [message] 被转发的消息
/// Create a forwarded message
/// [message] Message to be forwarded
Future<Message> createForwardMessage({
required Message message,
String? operationID,
@@ -391,10 +389,10 @@ class MessageManager {
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
}
/// 创建位置消息
/// [latitude] 纬度
/// [longitude] 经度
/// [description] 自定义描述信息
/// Create a location message
/// [latitude] Latitude
/// [longitude] Longitude
/// [description] Custom description
Future<Message> createLocationMessage({
required double latitude,
required double longitude,
@@ -412,10 +410,10 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建自定义消息
/// [data] 自定义数据
/// [extension] 自定义扩展内容
/// [description] 自定义描述内容
/// Create a custom message
/// [data] Custom data
/// [extension] Custom extension content
/// [description] Custom description content
Future<Message> createCustomMessage({
required String data,
required String extension,
@@ -433,9 +431,9 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建引用消息
/// [text] 回复的内容
/// [quoteMsg] 被回复的消息
/// Create a quoted message
/// [text] Reply content
/// [quoteMsg] Message being replied to
Future<Message> createQuoteMessage({
required String text,
required Message quoteMsg,
@@ -451,8 +449,8 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建卡片消息
/// [data] 自定义数据
/// Create a card message
/// [data] Custom data
Future<Message> createCardMessage({
required String userID,
required String nickname,
@@ -474,9 +472,9 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建自定义表情消息
/// [index] 位置表情,根据index匹配
/// [data] url表情直接使用url显示
/// Create a custom emoji message
/// [index] Positional emoji, matched based on index
/// [data] URL emoji, displayed directly using the URL
Future<Message> createFaceMessage({
int index = -1,
String? data,
@@ -492,16 +490,16 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 搜索消息
/// [conversationID] 根据会话查询如果是全局搜索传null
/// [keywordList] 搜索关键词列表,目前仅支持一个关键词搜索
/// [keywordListMatchType] 关键词匹配模式1代表与2代表或暂时未用
/// [senderUserIDList] 指定消息发送的uid列表 暂时未用
/// [messageTypeList] 消息类型列表
/// [searchTimePosition] 搜索的起始时间点。默认为0即代表从现在开始搜索。UTC 时间戳,单位:秒
/// [searchTimePeriod] 从起始时间点开始的过去时间范围单位秒。默认为0即代表不限制时间范围传24x60x60代表过去一天
/// [pageIndex] 当前页数
/// [count] 每页数量
/// Search messages
/// [conversationID] Query based on conversation, pass null for global search
/// [keywordList] Search keyword list, currently supports searching with a single keyword
/// [keywordListMatchType] Keyword matching mode, 1 means AND, 2 means OR (currently unused)
/// [senderUserIDList] List of UIDs for messages sent (currently unused)
/// [messageTypeList] Message type list
/// [searchTimePosition] Start time point for searching. Defaults to 0, meaning searching from now. UTC timestamp, in seconds
/// [searchTimePeriod] Time range in the past from the start time point, in seconds. Defaults to 0, meaning no time range limitation. Pass 24x60x60 to represent the past day
/// [pageIndex] Current page number
/// [count] Number of messages per page
Future<SearchResult> searchLocalMessages({
String? conversationID,
List<String> keywordList = const [],
@@ -531,10 +529,11 @@ class MessageManager {
},
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map)));
.then((value) =>
Utils.toObj(value, (map) => SearchResult.fromJson(map)));
/// 撤回消息
/// [message] 被撤回的消息体
/// Revoke a message
/// [message] The message to be revoked
Future revokeMessage({
required String conversationID,
required String clientMsgID,
@@ -548,9 +547,9 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 标记消息已读
/// [conversationID] 会话ID
/// [messageIDList] 被标记的消息clientMsgID
/// Mark messages as read
/// [conversationID] Conversation ID
/// [messageIDList] List of clientMsgIDs of messages to be marked as read
Future markMessagesAsReadByMsgID({
required String conversationID,
required List<String> messageIDList,
@@ -564,11 +563,11 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// 获取聊天记录(以startMsg为节点以前的聊天记录)
/// [conversationID] 会话id查询通知时可用
/// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息所以获取下一页历史记录startMsg=list.first
/// [count] 一次拉取的总数
/// [lastMinSeq] 第一页消息不用传,获取第二页开始必传 跟[startMsg]一样
/// Get chat history (messages prior to startMsg)
/// [conversationID] Conversation ID, can be used for querying notifications
/// [startMsg] Query [count] messages starting from this message. The message at index == length - 1 is the latest message, so to get the next page of history, use startMsg = list.first
/// [count] Total number of messages to retrieve in one request
/// [lastMinSeq] Not required for the first page of messages, but necessary for getting the second page of history. Same as [startMsg]
Future<AdvancedMessage> getAdvancedHistoryMessageList({
String? conversationID,
Message? startMsg,
@@ -586,12 +585,13 @@ class MessageManager {
'lastMinSeq': lastMinSeq ?? 0,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
.then((value) =>
Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
/// 获取聊天记录(以startMsg为节点新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息
/// [conversationID] 会话id查询通知时可用
/// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息所以获取下一页历史记录startMsg=list.last
/// [count] 一次拉取的总数
/// Get chat history (newly received chat history after startMsg). Used for locating a specific message in global search and then fetching messages received after that message.
/// [conversationID] Conversation ID, can be used for querying notifications
/// [startMsg] Query [count] messages starting from this message. The message at index == length - 1 is the latest message, so to get the next page of history, use startMsg = list.last
/// [count] Total number of messages to retrieve in one request
Future<AdvancedMessage> getAdvancedHistoryMessageListReverse({
String? conversationID,
Message? startMsg,
@@ -609,11 +609,12 @@ class MessageManager {
'lastMinSeq': lastMinSeq ?? 0,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
.then((value) =>
Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
/// 查找消息详细
/// [conversationID] 会话id
/// [clientMsgIDList] 消息id列表
/// Find message details
/// [conversationID] Conversation ID
/// [clientMsgIDList] List of message IDs
Future<SearchResult> findMessageList({
required List<SearchParams> searchParams,
String? operationID,
@@ -625,11 +626,12 @@ class MessageManager {
'searchParams': searchParams.map((e) => e.toJson()).toList(),
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map)));
.then((value) =>
Utils.toObj(value, (map) => SearchResult.fromJson(map)));
/// 富文本消息
/// [text] 输入内容
/// [list] 富文本消息具体详细
/// Rich text message
/// [text] Input content
/// [list] Details of the rich text message
Future<Message> createAdvancedTextMessage({
required String text,
List<RichMessageInfo> list = const [],
@@ -646,10 +648,10 @@ class MessageManager {
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 富文本消息
/// [text] 回复的内容
/// [quoteMsg] 被回复的消息
/// [list] 富文本消息具体详细
/// Rich text message with quote
/// [text] Content for the reply
/// [quoteMsg] The message being replied to
/// [list] Details of the rich text message
Future<Message> createAdvancedQuoteMessage({
required String text,
required Message quoteMsg,
@@ -667,11 +669,11 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 发送消息
/// [message] 消息体 [createImageMessageByURL],[createSoundMessageByURL],[createVideoMessageByURL],[createFileMessageByURL]
/// [userID] 接收消息的用户id
/// [groupID] 接收消息的组id
/// [offlinePushInfo] 离线消息显示内容
/// Send a message
/// [message] Message body [createImageMessageByURL],[createSoundMessageByURL],[createVideoMessageByURL],[createFileMessageByURL]
/// [userID] User ID to receive the message
/// [groupID] Group ID to receive the message
/// [offlinePushInfo] Offline message display content
Future<Message> sendMessageNotOss({
required Message message,
required OfflinePushInfo offlinePushInfo,
@@ -691,7 +693,7 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建图片消息
/// Create an image message by URL
Future<Message> createImageMessageByURL({
required PictureInfo sourcePicture,
required PictureInfo bigPicture,
@@ -710,7 +712,7 @@ class MessageManager {
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建语音消息
/// Create a sound message
Future<Message> createSoundMessageByURL({
required SoundElem soundElem,
String? operationID,
@@ -725,7 +727,7 @@ class MessageManager {
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息
/// Create a video message
Future<Message> createVideoMessageByURL({
required VideoElem videoElem,
String? operationID,
@@ -739,7 +741,7 @@ class MessageManager {
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息
/// Create a file message
Future<Message> createFileMessageByURL({
required FileElem fileElem,
String? operationID,
@@ -775,85 +777,6 @@ class MessageManager {
}));
}
///
Future setMessageKvInfoListener(OnMessageKvInfoListener listener) {
this.messageKvInfoListener = listener;
return _channel.invokeMethod('setMessageKvInfoListener', _buildParam({}));
}
Future<List<TypeKeySetResult>> setMessageReactionExtensions({
required Message message,
List<KeyValue> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'setMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<TypeKeySetResult>> deleteMessageReactionExtensions({
required Message message,
List<String> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'deleteMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<MessageTypeKeyMapping>> getMessageListReactionExtensions({
List<Message> messageList = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'getMessageListReactionExtensions',
_buildParam({
'messageList': messageList.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => MessageTypeKeyMapping.fromJson(map)));
Future<List<TypeKeySetResult>> addMessageReactionExtensions({
required Message message,
List<KeyValue> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'addMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<MessageTypeKeyMapping>> getMessageListSomeReactionExtensions({
List<Message> messageList = const [],
List<KeyValue> kvList = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'getMessageListSomeReactionExtensions',
_buildParam({
'messageList': messageList.map((e) => e.toJson()).toList(),
'list': kvList.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => MessageTypeKeyMapping.fromJson(map)));
static Map _buildParam(Map param) {
param["ManagerName"] = "messageManager";
return param;

View File

@@ -7,14 +7,14 @@ class UserManager {
UserManager(this._channel);
/// 用户资料改变监听
/// User profile change listener
Future setUserListener(OnUserListener listener) {
this.listener = listener;
return _channel.invokeMethod('setUserListener', _buildParam({}));
}
/// 获取用户资料
/// [userIDList] 用户ID列表
/// Get user information
/// [userIDList] List of user IDs
Future<List<UserInfo>> getUsersInfo({
required List<String> userIDList,
String? operationID,
@@ -28,7 +28,7 @@ class UserManager {
}))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// 获取当前登录用户的信息
/// Get information of the currently logged-in user
Future<UserInfo> getSelfUserInfo({
String? operationID,
}) =>
@@ -40,20 +40,20 @@ class UserManager {
}))
.then((value) => Utils.toObj(value, (map) => UserInfo.fromJson(map)));
/// 修改当前登录用户资料
/// [nickname] 昵称
/// [faceURL] 头像
/// [gender] 性别
/// [appMangerLevel]
/// [phoneNumber] 手机号
/// [birth] 出生日期
/// [email] 邮箱
/// [ex] 扩展字段
/// Modify the profile of the currently logged-in user
/// [nickname] Nickname
/// [faceURL] Profile picture
/// [gender] Gender
/// [appManagerLevel]
/// [phoneNumber] Phone number
/// [birth] Date of birth
/// [email] Email
/// [ex] Additional fields
Future<String?> setSelfInfo({
String? nickname,
String? faceURL,
int? gender,
int? appMangerLevel,
int? appManagerLevel,
String? phoneNumber,
int? birth,
String? email,
@@ -67,7 +67,7 @@ class UserManager {
'nickname': nickname,
'faceURL': faceURL,
'gender': gender,
'appMangerLevel': appMangerLevel,
'appManagerLevel': appManagerLevel,
'phoneNumber': phoneNumber,
'birth': birth,
'email': email,
@@ -86,7 +86,8 @@ class UserManager {
'userIDs': userIDs,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
}
Future<List<UserStatusInfo>> unsubscribeUsersStatus(
@@ -100,7 +101,8 @@ class UserManager {
'userIDs': userIDs,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
}
Future<List<UserStatusInfo>> getSubscribeUsersStatus({
@@ -112,7 +114,8 @@ class UserManager {
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
}
Future<List<UserStatusInfo>> getUserStatus(
@@ -126,7 +129,8 @@ class UserManager {
'userIDs': userIDs,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
}
Future<List<UserInfo>> getUsersInfoStranger(