open 3.0
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
@@ -71,26 +73,13 @@ class ConversationManager {
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getMultipleConversation',
|
||||
_buildParam({
|
||||
"conversationIDList": conversationIDList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
|
||||
|
||||
/// 通过会话id删除指定会话
|
||||
/// [conversationID] 被删除的会话的id
|
||||
Future deleteConversation({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteConversation',
|
||||
'getMultipleConversation',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"conversationIDList": conversationIDList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
|
||||
|
||||
/// 设置会话草稿
|
||||
/// [conversationID] 会话id
|
||||
@@ -124,6 +113,19 @@ class ConversationManager {
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 置顶会话
|
||||
/// [conversationID] 会话id
|
||||
Future hideConversation({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'hideConversation',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 获取未读消息总数
|
||||
/// int.tryParse(count) ?? 0;
|
||||
Future<dynamic> getTotalUnreadMsgCount({
|
||||
@@ -138,29 +140,29 @@ class ConversationManager {
|
||||
/// 查询会话id
|
||||
/// [sourceID] 如果是单聊值传用户ID,如果是群聊值传组ID
|
||||
/// [sessionType] 参考[ConversationType]
|
||||
Future<dynamic> getConversationIDBySessionType({
|
||||
required String sourceID,
|
||||
required int sessionType,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'getConversationIDBySessionType',
|
||||
_buildParam({
|
||||
"sourceID": sourceID,
|
||||
"sessionType": sessionType,
|
||||
}));
|
||||
// Future<dynamic> getConversationIDBySessionType({
|
||||
// required String sourceID,
|
||||
// required int sessionType,
|
||||
// }) =>
|
||||
// _channel.invokeMethod(
|
||||
// 'getConversationIDBySessionType',
|
||||
// _buildParam({
|
||||
// "sourceID": sourceID,
|
||||
// "sessionType": sessionType,
|
||||
// }));
|
||||
|
||||
/// 消息免打扰设置
|
||||
/// [conversationIDList] 会话id列表
|
||||
/// [conversationID] 会话id
|
||||
/// [status] 0:正常;1:不接受消息;2:接受在线消息不接受离线消息;
|
||||
Future<dynamic> setConversationRecvMessageOpt({
|
||||
required List<String> conversationIDList,
|
||||
required String conversationID,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationRecvMessageOpt',
|
||||
_buildParam({
|
||||
"conversationIDList": conversationIDList,
|
||||
"conversationID": conversationID,
|
||||
"status": status,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
@@ -184,13 +186,13 @@ class ConversationManager {
|
||||
/// 阅后即焚
|
||||
/// [conversationID] 会话id
|
||||
/// [isPrivate] true:开启,false:关闭
|
||||
Future<dynamic> setOneConversationPrivateChat({
|
||||
Future<dynamic> setConversationPrivateChat({
|
||||
required String conversationID,
|
||||
required bool isPrivate,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setOneConversationPrivateChat',
|
||||
'setConversationPrivateChat',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isPrivate": isPrivate,
|
||||
@@ -199,12 +201,25 @@ class ConversationManager {
|
||||
|
||||
/// 删除本地以及服务器的会话
|
||||
/// [conversationID] 会话ID
|
||||
Future<dynamic> deleteConversationFromLocalAndSvr({
|
||||
Future<dynamic> deleteConversationAndDeleteAllMsg({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteConversationFromLocalAndSvr',
|
||||
'deleteConversationAndDeleteAllMsg',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 清空会话里的消息
|
||||
/// [conversationID] 会话ID
|
||||
Future<dynamic> clearConversationAndDeleteAllMsg({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearConversationAndDeleteAllMsg',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
@@ -234,8 +249,14 @@ class ConversationManager {
|
||||
}));
|
||||
|
||||
/// 查询@所有人标识
|
||||
Future<dynamic> getAtAllTag() =>
|
||||
_channel.invokeMethod('getAtAllTag', _buildParam({}));
|
||||
Future<dynamic> getAtAllTag({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'getAtAllTag',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 查询@所有人标识
|
||||
String get atAllTag => 'atAllTag';
|
||||
@@ -256,19 +277,33 @@ class ConversationManager {
|
||||
/// 设置阅后即焚时长
|
||||
/// [conversationID] 会话id
|
||||
/// [burnDuration] 时长s,默认30s
|
||||
Future<dynamic> setOneConversationBurnDuration({
|
||||
Future<dynamic> setConversationBurnDuration({
|
||||
required String conversationID,
|
||||
int burnDuration = 30,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setOneConversationBurnDuration',
|
||||
'setConversationBurnDuration',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"burnDuration": burnDuration,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 标记消息已读
|
||||
/// [conversationID] 会话ID
|
||||
/// [messageIDList] 被标记的消息clientMsgID
|
||||
Future markConversationMessageAsRead({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'markConversationMessageAsRead',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 会话列表自定义排序规则。
|
||||
List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list
|
||||
..sort((a, b) {
|
||||
@@ -279,23 +314,24 @@ class ConversationManager {
|
||||
: a.latestMsgSendTime!;
|
||||
int bCompare = b.draftTextTime! > b.latestMsgSendTime!
|
||||
? b.draftTextTime!
|
||||
: b.latestMsgSendTime!;
|
||||
if (aCompare > bCompare) {
|
||||
return -1;
|
||||
} else if (aCompare < bCompare) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (a.isPinned == true && b.isPinned != true) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
: b.latestMsgSendTime!;
|
||||
if (aCompare > bCompare) {
|
||||
return -1;
|
||||
} else if (aCompare < bCompare) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (a.isPinned == true && b.isPinned != true) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "conversationManager";
|
||||
log('param: $param');
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,42 +14,42 @@ class FriendshipManager {
|
||||
}
|
||||
|
||||
/// 查询好友信息
|
||||
/// [uidList] userID集合
|
||||
/// [userIDList] userID集合
|
||||
Future<List<UserInfo>> getFriendsInfo({
|
||||
required List<String> uidList,
|
||||
required List<String> userIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getFriendsInfo',
|
||||
_buildParam({
|
||||
"uidList": uidList,
|
||||
"userIDList": userIDList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
|
||||
|
||||
/// 发送一个好友请求,需要对方调用同意申请才能成为好友。
|
||||
/// [uid] 被邀请的用户ID
|
||||
/// [userID] 被邀请的用户ID
|
||||
/// [reason] 备注说明
|
||||
Future<dynamic> addFriend({
|
||||
required String uid,
|
||||
required String userID,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'addFriend',
|
||||
_buildParam({
|
||||
"toUserID": uid,
|
||||
"toUserID": userID,
|
||||
"reqMsg": reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 获取别人加我为好友的申请
|
||||
Future<List<FriendApplicationInfo>> getRecvFriendApplicationList(
|
||||
Future<List<FriendApplicationInfo>> getFriendApplicationListAsRecipient(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getRecvFriendApplicationList',
|
||||
'getFriendApplicationListAsRecipient',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
@@ -57,11 +57,11 @@ class FriendshipManager {
|
||||
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
|
||||
|
||||
/// 获取我发出的好友申请
|
||||
Future<List<FriendApplicationInfo>> getSendFriendApplicationList(
|
||||
Future<List<FriendApplicationInfo>> getFriendApplicationListAsApplicant(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getSendFriendApplicationList',
|
||||
'getFriendApplicationListAsApplicant',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
@@ -87,31 +87,31 @@ class FriendshipManager {
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
/// 设置好友备注
|
||||
/// [uid] 好友的userID
|
||||
/// [userID] 好友的userID
|
||||
/// [remark] 好友的备注
|
||||
Future<dynamic> setFriendRemark({
|
||||
required String uid,
|
||||
required String userID,
|
||||
required String remark,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setFriendRemark',
|
||||
_buildParam({
|
||||
'toUserID': uid,
|
||||
'toUserID': userID,
|
||||
'remark': remark,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 加入黑名单
|
||||
/// [uid] 被加入黑名单的好友ID
|
||||
/// [userID] 被加入黑名单的好友ID
|
||||
Future<dynamic> addBlacklist({
|
||||
required String uid,
|
||||
required String userID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'addBlacklist',
|
||||
_buildParam({
|
||||
"uid": uid,
|
||||
"userID": userID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
@@ -125,75 +125,75 @@ class FriendshipManager {
|
||||
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
|
||||
|
||||
/// 从黑名单移除
|
||||
/// [uid] 用户ID
|
||||
/// [userID] 用户ID
|
||||
Future<dynamic> removeBlacklist({
|
||||
required String uid,
|
||||
required String userID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'removeBlacklist',
|
||||
_buildParam({
|
||||
"uid": uid,
|
||||
"userID": userID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 检查友好关系
|
||||
/// [uidList] userID列表
|
||||
/// [userIDList] userID列表
|
||||
Future<List<FriendshipInfo>> checkFriend({
|
||||
required List<String> uidList,
|
||||
required List<String> userIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'checkFriend',
|
||||
_buildParam({
|
||||
'uidList': uidList,
|
||||
'userIDList': userIDList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (v) => FriendshipInfo.fromJson(v)));
|
||||
|
||||
/// 删除好友
|
||||
/// [uid] 用户ID
|
||||
/// [userID] 用户ID
|
||||
Future<dynamic> deleteFriend({
|
||||
required String uid,
|
||||
required String userID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteFriend',
|
||||
_buildParam({
|
||||
"uid": uid,
|
||||
"userID": userID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 接受好友请求
|
||||
/// [uid] 用户ID
|
||||
/// [userID] 用户ID
|
||||
/// [handleMsg]备注说明
|
||||
Future<dynamic> acceptFriendApplication({
|
||||
required String uid,
|
||||
required String userID,
|
||||
String? handleMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'acceptFriendApplication',
|
||||
_buildParam({
|
||||
"toUserID": uid,
|
||||
"toUserID": userID,
|
||||
"handleMsg": handleMsg,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 拒绝好友请求
|
||||
/// [uid] 用户ID
|
||||
/// [userID] 用户ID
|
||||
/// [handleMsg]备注说明
|
||||
Future<dynamic> refuseFriendApplication({
|
||||
required String uid,
|
||||
required String userID,
|
||||
String? handleMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'refuseFriendApplication',
|
||||
_buildParam({
|
||||
"toUserID": uid,
|
||||
"toUserID": userID,
|
||||
"handleMsg": handleMsg,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
@@ -14,11 +16,11 @@ class GroupManager {
|
||||
}
|
||||
|
||||
/// 邀请进组,直接进组无需同意。
|
||||
/// [groupId] 组ID
|
||||
/// [uidList] 用户ID列表
|
||||
/// [groupID] 组ID
|
||||
/// [userIDList] 用户ID列表
|
||||
Future<List<GroupInviteResult>> inviteUserToGroup({
|
||||
required String groupId,
|
||||
required List<String> uidList,
|
||||
required String groupID,
|
||||
required List<String> userIDList,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
@@ -26,21 +28,21 @@ class GroupManager {
|
||||
.invokeMethod(
|
||||
'inviteUserToGroup',
|
||||
_buildParam({
|
||||
'gid': groupId,
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
'uidList': uidList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
|
||||
|
||||
/// 移除组成员
|
||||
/// [groupId] 组ID
|
||||
/// [uidList] 用户ID列表
|
||||
/// [groupID] 组ID
|
||||
/// [userIDList] 用户ID列表
|
||||
/// [reason] 备注说明
|
||||
Future<List<GroupInviteResult>> kickGroupMember({
|
||||
required String groupId,
|
||||
required List<String> uidList,
|
||||
required String groupID,
|
||||
required List<String> userIDList,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
@@ -48,40 +50,40 @@ class GroupManager {
|
||||
.invokeMethod(
|
||||
'kickGroupMember',
|
||||
_buildParam({
|
||||
'gid': groupId,
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
'uidList': uidList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
|
||||
|
||||
/// 查询组成员资料
|
||||
/// [groupId] 组ID
|
||||
/// [uidList] 用户ID列表
|
||||
/// [groupID] 组ID
|
||||
/// [userIDList] 用户ID列表
|
||||
Future<List<GroupMembersInfo>> getGroupMembersInfo({
|
||||
required String groupId,
|
||||
required List<String> uidList,
|
||||
required String groupID,
|
||||
required List<String> userIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getGroupMembersInfo',
|
||||
_buildParam({
|
||||
'gid': groupId,
|
||||
'uidList': uidList,
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
|
||||
|
||||
/// 分页获取组成员列表
|
||||
/// [groupId] 群ID
|
||||
/// [filter] 过滤成员 0所有,1普通成员, 2群主,3管理员,4管理员+普通成员
|
||||
/// [groupID] 群ID
|
||||
/// [filter] 过滤成员 0所有,1群主 , 2管理员,3普通成员,4管理员+普通成员 5,群主+管理员
|
||||
/// [offset] 开始下标
|
||||
/// [count] 总数
|
||||
Future<List<GroupMembersInfo>> getGroupMemberList({
|
||||
required String groupId,
|
||||
required String groupID,
|
||||
int filter = 0,
|
||||
int offset = 0,
|
||||
int count = 0,
|
||||
@@ -91,7 +93,7 @@ class GroupManager {
|
||||
.invokeMethod(
|
||||
'getGroupMemberList',
|
||||
_buildParam({
|
||||
'gid': groupId,
|
||||
'groupID': groupID,
|
||||
'filter': filter,
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
@@ -101,12 +103,12 @@ class GroupManager {
|
||||
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
|
||||
|
||||
/// 分页获取组成员列表
|
||||
/// [groupId] 群ID
|
||||
/// [filter] 过滤成员 0所有,1普通成员, 2群主,3管理员,4管理员+普通成员
|
||||
/// [groupID] 群ID
|
||||
/// [filter] 过滤成员 0所有,1群主 , 2管理员,3普通成员,4管理员+普通成员 5,群主+管理员
|
||||
/// [offset] 开始下标
|
||||
/// [count] 总数
|
||||
Future<List<dynamic>> getGroupMemberListMap({
|
||||
required String groupId,
|
||||
required String groupID,
|
||||
int filter = 0,
|
||||
int offset = 0,
|
||||
int count = 0,
|
||||
@@ -116,7 +118,7 @@ class GroupManager {
|
||||
.invokeMethod(
|
||||
'getGroupMemberList',
|
||||
_buildParam({
|
||||
'gid': groupId,
|
||||
'groupID': groupID,
|
||||
'filter': filter,
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
@@ -143,14 +145,19 @@ class GroupManager {
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
/// 检查是否已加入组
|
||||
/// [gid] 组ID
|
||||
/// [groupID] 组ID
|
||||
Future<bool> isJoinedGroup({
|
||||
required String gid,
|
||||
required String groupID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
getJoinedGroupList(
|
||||
operationID: Utils.checkOperationID(operationID),
|
||||
).then((list) => list.where((e) => e.groupID == gid).length > 0);
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'isJoinGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => value == 'true' ? true : false);
|
||||
|
||||
/// 创建一个组
|
||||
/// [groupName] 群名
|
||||
@@ -161,28 +168,20 @@ class GroupManager {
|
||||
/// [ex] 额外信息
|
||||
/// [list] 初创群成员以及其角色列表[GroupMemberRole]
|
||||
Future<GroupInfo> createGroup({
|
||||
String? groupName,
|
||||
String? notification,
|
||||
String? introduction,
|
||||
String? faceUrl,
|
||||
int? groupType,
|
||||
String? ex,
|
||||
required List<GroupMemberRole> list,
|
||||
required GroupInfo groupInfo,
|
||||
List<String> memberUserIDs = const [],
|
||||
List<String> adminUserIDs = const [],
|
||||
String? ownerUserID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createGroup',
|
||||
_buildParam({
|
||||
'gInfo': {
|
||||
"groupName": groupName,
|
||||
"notification": notification,
|
||||
"introduction": introduction,
|
||||
"faceURL": faceUrl,
|
||||
"groupType": groupType,
|
||||
"ex": ex,
|
||||
},
|
||||
'memberList': list.map((e) => e.toJson()).toList(),
|
||||
'groupInfo': groupInfo.toJson(),
|
||||
'memberUserIDs': memberUserIDs,
|
||||
'adminUserIDs': adminUserIDs,
|
||||
'ownerUserID': ownerUserID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then(
|
||||
@@ -193,43 +192,48 @@ class GroupManager {
|
||||
/// [groupName] 新的群名
|
||||
/// [notification] 新的公告
|
||||
/// [introduction] 新的群介绍
|
||||
/// [faceUrl] 新的群头像
|
||||
/// [faceURL] 新的群头像
|
||||
/// [ex] 新的额外信息
|
||||
Future<dynamic> setGroupInfo({
|
||||
required String groupID,
|
||||
String? groupName,
|
||||
String? notification,
|
||||
String? introduction,
|
||||
String? faceUrl,
|
||||
String? faceURL,
|
||||
String? ex,
|
||||
int? needVerification,
|
||||
int? lookMemberInfo,
|
||||
int? applyMemberFriend,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupInfo',
|
||||
_buildParam({
|
||||
"gid": groupID,
|
||||
'gInfo': {
|
||||
// "groupID": groupID,
|
||||
'groupInfo': {
|
||||
"groupID": groupID,
|
||||
"groupName": groupName,
|
||||
"notification": notification,
|
||||
"introduction": introduction,
|
||||
"faceURL": faceUrl,
|
||||
"faceURL": faceURL,
|
||||
"ex": ex,
|
||||
'needVerification': needVerification,
|
||||
'lookMemberInfo': lookMemberInfo,
|
||||
'applyMemberFriend': applyMemberFriend,
|
||||
},
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 查询组信息
|
||||
/// [gidList] 组ID列表
|
||||
/// [groupIDList] 组ID列表
|
||||
Future<List<GroupInfo>> getGroupsInfo({
|
||||
required List<String> gidList,
|
||||
required List<String> groupIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getGroupsInfo',
|
||||
_buildParam({
|
||||
'gidList': gidList,
|
||||
'groupIDList': groupIDList,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then(
|
||||
@@ -238,7 +242,7 @@ class GroupManager {
|
||||
/// 申请加入组,需要通过管理员/群组同意。
|
||||
/// [joinSource] 2:通过邀请 3:通过搜索 4:通过二维码
|
||||
Future<dynamic> joinGroup({
|
||||
required String gid,
|
||||
required String groupID,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
int joinSource = 3,
|
||||
@@ -246,7 +250,7 @@ class GroupManager {
|
||||
_channel.invokeMethod(
|
||||
'joinGroup',
|
||||
_buildParam({
|
||||
'gid': gid,
|
||||
'groupID': groupID,
|
||||
'reason': reason,
|
||||
'joinSource': joinSource,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
@@ -254,38 +258,38 @@ class GroupManager {
|
||||
|
||||
/// 退出组
|
||||
Future<dynamic> quitGroup({
|
||||
required String gid,
|
||||
required String groupID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'quitGroup',
|
||||
_buildParam({
|
||||
'gid': gid,
|
||||
'groupID': groupID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 转移组拥有者权限
|
||||
/// [gid] 组ID
|
||||
/// [uid] 新拥有者ID
|
||||
/// [groupID] 组ID
|
||||
/// [userID] 新拥有者ID
|
||||
Future<dynamic> transferGroupOwner({
|
||||
required String gid,
|
||||
required String uid,
|
||||
required String groupID,
|
||||
required String userID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'transferGroupOwner',
|
||||
_buildParam({
|
||||
'gid': gid,
|
||||
'uid': uid,
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 作为群主或者管理员,收到的群成员入群申请
|
||||
Future<List<GroupApplicationInfo>> getRecvGroupApplicationList(
|
||||
Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getRecvGroupApplicationList',
|
||||
'getGroupApplicationListAsRecipient',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
@@ -293,11 +297,11 @@ class GroupManager {
|
||||
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
|
||||
|
||||
/// 获取自己发出的入群申请记录
|
||||
Future<List<GroupApplicationInfo>> getSendGroupApplicationList(
|
||||
Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getSendGroupApplicationList',
|
||||
'getGroupApplicationListAsApplicant',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
@@ -306,39 +310,39 @@ class GroupManager {
|
||||
|
||||
/// 管理员或者群主同意某人进入某群
|
||||
/// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理
|
||||
/// [gid] 组id
|
||||
/// [uid] 申请者用户ID
|
||||
/// [groupID] 组id
|
||||
/// [userID] 申请者用户ID
|
||||
Future<dynamic> acceptGroupApplication({
|
||||
required String gid,
|
||||
required String uid,
|
||||
required String groupID,
|
||||
required String userID,
|
||||
String? handleMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'acceptGroupApplication',
|
||||
_buildParam({
|
||||
'gid': gid,
|
||||
'uid': uid,
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'handleMsg': handleMsg,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 管理员或者群主拒绝某人进入某群
|
||||
/// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理
|
||||
/// [gid] 组id
|
||||
/// [uid] 申请者用户ID
|
||||
/// [groupID] 组id
|
||||
/// [userID] 申请者用户ID
|
||||
/// [handleMsg] 说明
|
||||
Future<dynamic> refuseGroupApplication({
|
||||
required String gid,
|
||||
required String uid,
|
||||
required String groupID,
|
||||
required String userID,
|
||||
String? handleMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'refuseGroupApplication',
|
||||
_buildParam({
|
||||
'gid': gid,
|
||||
'uid': uid,
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'handleMsg': handleMsg,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
@@ -352,7 +356,7 @@ class GroupManager {
|
||||
_channel.invokeMethod(
|
||||
'dismissGroup',
|
||||
_buildParam({
|
||||
'gid': groupID,
|
||||
'groupID': groupID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
@@ -367,7 +371,7 @@ class GroupManager {
|
||||
_channel.invokeMethod(
|
||||
'changeGroupMute',
|
||||
_buildParam({
|
||||
'gid': groupID,
|
||||
'groupID': groupID,
|
||||
'mute': mute,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
@@ -385,8 +389,8 @@ class GroupManager {
|
||||
_channel.invokeMethod(
|
||||
'changeGroupMemberMute',
|
||||
_buildParam({
|
||||
'gid': groupID,
|
||||
'uid': userID,
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'seconds': seconds,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
@@ -404,8 +408,8 @@ class GroupManager {
|
||||
_channel.invokeMethod(
|
||||
'setGroupMemberNickname',
|
||||
_buildParam({
|
||||
'gid': groupID,
|
||||
'uid': userID,
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'groupNickname': groupNickname ?? '',
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
@@ -633,6 +637,7 @@ class GroupManager {
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "groupManager";
|
||||
log('param: $param');
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,15 @@ class IMManager {
|
||||
|
||||
// late OfflinePushManager offlinePushManager;
|
||||
late SignalingManager signalingManager;
|
||||
late WorkMomentsManager workMomentsManager;
|
||||
late OrganizationManager organizationManager;
|
||||
|
||||
// late WorkMomentsManager workMomentsManager;
|
||||
// late OrganizationManager organizationManager;
|
||||
|
||||
late OnConnectListener _connectListener;
|
||||
OnListenerForService? _listenerForService;
|
||||
late String uid;
|
||||
late UserInfo uInfo;
|
||||
OnPutFileListener? _putFileListener;
|
||||
late String userID;
|
||||
late UserInfo userInfo;
|
||||
bool isLogined = false;
|
||||
String? token;
|
||||
String? _objectStorage;
|
||||
@@ -34,8 +36,8 @@ class IMManager {
|
||||
userManager = UserManager(_channel);
|
||||
// offlinePushManager = OfflinePushManager(_channel);
|
||||
signalingManager = SignalingManager(_channel);
|
||||
workMomentsManager = WorkMomentsManager(_channel);
|
||||
organizationManager = OrganizationManager(_channel);
|
||||
// workMomentsManager = WorkMomentsManager(_channel);
|
||||
// organizationManager = OrganizationManager(_channel);
|
||||
_addNativeCallback(_channel);
|
||||
}
|
||||
|
||||
@@ -69,8 +71,8 @@ class IMManager {
|
||||
dynamic data = call.arguments['data'];
|
||||
switch (type) {
|
||||
case 'onSelfInfoUpdated':
|
||||
uInfo = Utils.toObj(data, (map) => UserInfo.fromJson(map));
|
||||
userManager.listener.selfInfoUpdated(uInfo);
|
||||
userInfo = Utils.toObj(data, (map) => UserInfo.fromJson(map));
|
||||
userManager.listener.selfInfoUpdated(userInfo);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.groupListener) {
|
||||
@@ -97,6 +99,10 @@ class IMManager {
|
||||
data, (map) => GroupApplicationInfo.fromJson(map));
|
||||
groupManager.listener.groupApplicationRejected(i);
|
||||
break;
|
||||
case 'onGroupDismissed':
|
||||
final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map));
|
||||
groupManager.listener.groupDismissed(i);
|
||||
break;
|
||||
case 'onGroupInfoChanged':
|
||||
final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map));
|
||||
groupManager.listener.groupInfoChanged(i);
|
||||
@@ -129,52 +135,59 @@ class IMManager {
|
||||
var type = call.arguments['type'];
|
||||
// var id = call.arguments['data']['id'];
|
||||
switch (type) {
|
||||
case 'onRecvNewMessage':
|
||||
var value = call.arguments['data']['newMessage'];
|
||||
case 'onMsgDeleted':
|
||||
var value = call.arguments['data']['message'];
|
||||
final msg = Utils.toObj(value, (map) => Message.fromJson(map));
|
||||
messageManager.msgListener.recvNewMessage(msg);
|
||||
break;
|
||||
case 'onRecvMessageRevoked':
|
||||
var msgID = call.arguments['data']['revokedMessage'];
|
||||
messageManager.msgListener.recvMessageRevoked(msgID);
|
||||
break;
|
||||
case 'onRecvC2CReadReceipt':
|
||||
var value = call.arguments['data']['c2cMessageReadReceipt'];
|
||||
var list =
|
||||
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
|
||||
messageManager.msgListener.recvC2CMessageReadReceipt(list);
|
||||
break;
|
||||
case 'onRecvGroupReadReceipt':
|
||||
var value = call.arguments['data']['groupMessageReadReceipt'];
|
||||
var list =
|
||||
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
|
||||
messageManager.msgListener.recvGroupMessageReadReceipt(list);
|
||||
messageManager.msgListener.msgDeleted(msg);
|
||||
break;
|
||||
case 'onNewRecvMessageRevoked':
|
||||
var value = call.arguments['data']['revokedMessageV2'];
|
||||
var value = call.arguments['data']['messageRevoked'];
|
||||
var info = Utils.toObj(value, (map) => RevokedInfo.fromJson(map));
|
||||
messageManager.msgListener.recvMessageRevokedV2(info);
|
||||
messageManager.msgListener.newRecvMessageRevoked(info);
|
||||
break;
|
||||
case 'onRecvC2CReadReceipt':
|
||||
var value = call.arguments['data']['msgReceiptList'];
|
||||
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));
|
||||
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']['list'];
|
||||
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']['list'];
|
||||
var value = call.arguments['data']['reactionExtensionKeyList'];
|
||||
var list = Utils.toList(value, (map) => '$map');
|
||||
messageManager.msgListener
|
||||
.recvMessageExtensionsDeleted(msgID, list);
|
||||
break;
|
||||
case 'onRecvMessageExtensionsAdded':
|
||||
var msgID = call.arguments['data']['msgID'];
|
||||
var value = call.arguments['data']['list'];
|
||||
var list = Utils.toList(value, (map) => KeyValue.fromJson(map));
|
||||
messageManager.msgListener
|
||||
.recvMessageExtensionsAdded(msgID, list);
|
||||
|
||||
case 'onRecvNewMessage':
|
||||
var value = call.arguments['data']['message'];
|
||||
final msg = Utils.toObj(value, (map) => Message.fromJson(map));
|
||||
messageManager.msgListener.recvNewMessage(msg);
|
||||
break;
|
||||
case 'onRecvOfflineNewMessages':
|
||||
var value = call.arguments['data']['messageList'];
|
||||
final list = Utils.toList(value, (map) => Message.fromJson(map));
|
||||
messageManager.msgListener.recvOfflineNewMessages(list);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.msgSendProgressListener) {
|
||||
@@ -224,13 +237,17 @@ class IMManager {
|
||||
dynamic data = call.arguments['data'];
|
||||
|
||||
switch (type) {
|
||||
case 'onBlacklistAdded':
|
||||
case 'onBlackAdded':
|
||||
final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map));
|
||||
friendshipManager.listener.blacklistAdded(u);
|
||||
friendshipManager.listener.blackAdded(u);
|
||||
break;
|
||||
case 'onBlacklistDeleted':
|
||||
case 'onBlackDeleted':
|
||||
final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map));
|
||||
friendshipManager.listener.blacklistDeleted(u);
|
||||
friendshipManager.listener.blackDeleted(u);
|
||||
break;
|
||||
case 'onFriendAdded':
|
||||
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
|
||||
friendshipManager.listener.friendAdded(u);
|
||||
break;
|
||||
case 'onFriendApplicationAccepted':
|
||||
final u = Utils.toObj(
|
||||
@@ -252,18 +269,14 @@ class IMManager {
|
||||
data, (map) => FriendApplicationInfo.fromJson(map));
|
||||
friendshipManager.listener.friendApplicationRejected(u);
|
||||
break;
|
||||
case 'onFriendInfoChanged':
|
||||
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
|
||||
friendshipManager.listener.friendInfoChanged(u);
|
||||
break;
|
||||
case 'onFriendAdded':
|
||||
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
|
||||
friendshipManager.listener.friendAdded(u);
|
||||
break;
|
||||
case 'onFriendDeleted':
|
||||
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
|
||||
friendshipManager.listener.friendDeleted(u);
|
||||
break;
|
||||
case 'onFriendInfoChanged':
|
||||
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
|
||||
friendshipManager.listener.friendInfoChanged(u);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.signalingListener) {
|
||||
String type = call.arguments['type'];
|
||||
@@ -323,7 +336,8 @@ class IMManager {
|
||||
signalingManager.listener.receiveCustomSignal(info);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.workMomentsListener) {
|
||||
}
|
||||
/*else if (call.method == ListenerType.workMomentsListener) {
|
||||
String type = call.arguments['type'];
|
||||
switch (type) {
|
||||
case 'OnRecvNewNotification':
|
||||
@@ -337,7 +351,8 @@ class IMManager {
|
||||
organizationManager.listener.organizationUpdated();
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.customBusinessListener) {
|
||||
}*/
|
||||
else if (call.method == ListenerType.customBusinessListener) {
|
||||
String type = call.arguments['type'];
|
||||
String data = call.arguments['data'];
|
||||
switch (type) {
|
||||
@@ -385,6 +400,47 @@ class IMManager {
|
||||
_listenerForService?.recvNewMessage(msg);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.putFileListener) {
|
||||
String type = call.arguments['type'];
|
||||
dynamic data = call.arguments['data'];
|
||||
switch (type) {
|
||||
case 'hashComplete':
|
||||
String putID = data['putID'];
|
||||
String hash = data['hash'];
|
||||
int total = data['total'];
|
||||
_putFileListener?.hashComplete(putID, hash, total);
|
||||
break;
|
||||
case 'hashProgress':
|
||||
String putID = data['putID'];
|
||||
int current = data['current'];
|
||||
int total = data['total'];
|
||||
_putFileListener?.hashProgress(putID, current, total);
|
||||
break;
|
||||
case 'open':
|
||||
String putID = data['putID'];
|
||||
int size = data['size'];
|
||||
_putFileListener?.open(putID, size);
|
||||
break;
|
||||
case 'putComplete':
|
||||
String putID = data['putID'];
|
||||
int putType = data['putType'];
|
||||
int total = data['total'];
|
||||
_putFileListener?.putComplete(putID, putType, total);
|
||||
break;
|
||||
case 'putProgress':
|
||||
String putID = data['putID'];
|
||||
int save = data['save'];
|
||||
int current = data['current'];
|
||||
int total = data['total'];
|
||||
_putFileListener?.putProgress(putID, save, current, total);
|
||||
break;
|
||||
case 'putStart':
|
||||
String putID = data['putID'];
|
||||
int current = data['current'];
|
||||
int total = data['total'];
|
||||
_putFileListener?.putStart(putID, current, total);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (error, stackTrace) {
|
||||
Logger.print(
|
||||
@@ -404,7 +460,7 @@ class IMManager {
|
||||
/// [enabledEncryption] true:加密
|
||||
/// [enabledCompression] true:压缩
|
||||
Future<dynamic> initSDK({
|
||||
required int platform,
|
||||
required int platformID,
|
||||
required String apiAddr,
|
||||
required String wsAddr,
|
||||
required String dataDir,
|
||||
@@ -412,9 +468,11 @@ class IMManager {
|
||||
int logLevel = 6,
|
||||
String objectStorage = 'cos',
|
||||
String? encryptionKey,
|
||||
bool enabledEncryption = false,
|
||||
bool enabledCompression = false,
|
||||
bool isNeedEncryption = false,
|
||||
bool isCompression = false,
|
||||
bool isExternalExtensions = false,
|
||||
bool isLogStandardOutput = true,
|
||||
String? logFilePath,
|
||||
String? operationID,
|
||||
}) {
|
||||
this._connectListener = listener;
|
||||
@@ -423,32 +481,29 @@ class IMManager {
|
||||
'initSDK',
|
||||
_buildParam(
|
||||
{
|
||||
"platform": platform,
|
||||
"api_addr": apiAddr,
|
||||
"ws_addr": wsAddr,
|
||||
"data_dir": dataDir,
|
||||
"log_level": logLevel,
|
||||
"object_storage": objectStorage,
|
||||
"encryption_key": encryptionKey,
|
||||
"is_need_encryption": enabledEncryption,
|
||||
"is_compression": enabledCompression,
|
||||
"is_external_extensions": isExternalExtensions,
|
||||
"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),
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
/// 反初始化SDK
|
||||
Future<dynamic> unInitSDK() {
|
||||
return _channel.invokeMethod('unInitSDK', _buildParam({}));
|
||||
}
|
||||
|
||||
/// 登录
|
||||
/// [uid] 用户id
|
||||
/// [token] 登录token,从业务服务器上获取
|
||||
/// [defaultValue] 获取失败后使用的默认值
|
||||
Future<UserInfo> login({
|
||||
required String uid,
|
||||
required String userID,
|
||||
required String token,
|
||||
String? operationID,
|
||||
Future<UserInfo> Function()? defaultValue,
|
||||
@@ -456,20 +511,20 @@ class IMManager {
|
||||
await _channel.invokeMethod(
|
||||
'login',
|
||||
_buildParam({
|
||||
'uid': uid,
|
||||
'userID': userID,
|
||||
'token': token,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}),
|
||||
);
|
||||
this.isLogined = true;
|
||||
this.uid = uid;
|
||||
this.userID = userID;
|
||||
this.token = token;
|
||||
try {
|
||||
return this.uInfo = await userManager.getSelfUserInfo();
|
||||
return this.userInfo = await userManager.getSelfUserInfo();
|
||||
} catch (error, stackTrace) {
|
||||
log('login e: $error s: $stackTrace');
|
||||
if (null != defaultValue) {
|
||||
return this.uInfo = await (defaultValue.call());
|
||||
return this.userInfo = await (defaultValue.call());
|
||||
}
|
||||
return Future.error(error, stackTrace);
|
||||
}
|
||||
@@ -493,34 +548,24 @@ class IMManager {
|
||||
_channel.invokeMethod<int>('getLoginStatus', _buildParam({}));
|
||||
|
||||
/// 获取当前登录用户id
|
||||
Future<String> getLoginUserID() async => uid;
|
||||
Future<String> getLoginUserID() async => userID;
|
||||
|
||||
/// 获取当前登录用户信息
|
||||
Future<UserInfo> getLoginUserInfo() async => uInfo;
|
||||
Future<UserInfo> getLoginUserInfo() async => userInfo;
|
||||
|
||||
/// 从后台回到前台立刻唤醒
|
||||
Future wakeUp({String? operationID}) => _channel.invokeMethod(
|
||||
'wakeUp',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 上传图片到服务器
|
||||
/// [path] 图片路径
|
||||
/// [token] im token
|
||||
/// [objectStorage] 存储对象 cos/minio
|
||||
Future uploadImage({
|
||||
required String path,
|
||||
String? token,
|
||||
String? objectStorage,
|
||||
///
|
||||
Future putFile({
|
||||
required String putID,
|
||||
required String filePath,
|
||||
required String fileName,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'uploadImage',
|
||||
'putFile',
|
||||
_buildParam({
|
||||
'path': path,
|
||||
'token': token ?? this.token,
|
||||
'obj': objectStorage ?? this._objectStorage,
|
||||
'putID': putID,
|
||||
'filePath': filePath,
|
||||
'name': fileName,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
@@ -538,26 +583,30 @@ class IMManager {
|
||||
}));
|
||||
|
||||
/// 标记app处于后台
|
||||
Future setAppBackgroundStatus({
|
||||
required bool isBackground,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setAppBackgroundStatus',
|
||||
_buildParam({
|
||||
'isBackground': isBackground,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
// Future setAppBackgroundStatus({
|
||||
// required bool isBackground,
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel.invokeMethod(
|
||||
// 'setAppBackgroundStatus',
|
||||
// _buildParam({
|
||||
// 'isBackground': isBackground,
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }));
|
||||
|
||||
/// 网络改变
|
||||
Future networkChanged({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'networkChanged',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
// Future networkStatusChanged({
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel.invokeMethod(
|
||||
// 'networkStatusChanged',
|
||||
// _buildParam({
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }));
|
||||
|
||||
void setPutFileListener(OnPutFileListener listener) {
|
||||
_putFileListener = listener;
|
||||
}
|
||||
|
||||
///
|
||||
Future setListenerForService(OnListenerForService listener) {
|
||||
|
||||
@@ -52,59 +52,56 @@ class MessageManager {
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// 获取聊天记录(以startMsg为节点,以前的聊天记录)
|
||||
/// [userID] 接收消息的用户id
|
||||
/// [conversationID] 会话id,查询通知时可用
|
||||
/// [groupID] 接收消息的组id
|
||||
/// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.first
|
||||
/// [count] 一次拉取的总数
|
||||
Future<List<Message>> getHistoryMessageList({
|
||||
String? userID,
|
||||
String? groupID,
|
||||
String? conversationID,
|
||||
Message? startMsg,
|
||||
int? count,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getHistoryMessageList',
|
||||
_buildParam({
|
||||
'userID': userID ?? '',
|
||||
'groupID': groupID ?? '',
|
||||
'conversationID': conversationID ?? '',
|
||||
'startClientMsgID': startMsg?.clientMsgID ?? '',
|
||||
'count': count ?? 10,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// 撤回消息[revokeMessageV2]
|
||||
/// [message] 被撤回的消息体
|
||||
@deprecated
|
||||
Future revokeMessage({
|
||||
required Message message,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'revokeMessage',
|
||||
_buildParam(message.toJson()
|
||||
..addAll({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
})));
|
||||
|
||||
/// 删除本地消息
|
||||
/// [message] 被删除的消息体
|
||||
Future deleteMessageFromLocalStorage({
|
||||
required Message message,
|
||||
required String conversationID,
|
||||
required String clientMsgID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteMessageFromLocalStorage',
|
||||
_buildParam(message.toJson()
|
||||
..addAll({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
})));
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"clientMsgID": clientMsgID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// core-sdk: DeleteMessage
|
||||
/// 删除本地跟服务器的指定的消息
|
||||
/// [message] 被删除的消息
|
||||
Future<dynamic> deleteMessageFromLocalAndSvr({
|
||||
required String conversationID,
|
||||
required String clientMsgID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteMessageFromLocalAndSvr',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"clientMsgID": clientMsgID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 删除本地所有聊天记录
|
||||
Future<dynamic> deleteAllMsgFromLocal({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteAllMsgFromLocal',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 删除本地跟服务器所有聊天记录
|
||||
Future<dynamic> deleteAllMsgFromLocalAndSvr({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteAllMsgFromLocalAndSvr',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 插入单聊消息到本地
|
||||
/// [receiverID] 接收者id
|
||||
@@ -148,37 +145,6 @@ class MessageManager {
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// 标记c2c单条消息已读
|
||||
/// [userID] 消息来源的userID
|
||||
/// [messageIDList] 消息clientMsgID集合
|
||||
Future markC2CMessageAsRead({
|
||||
required String userID,
|
||||
required List<String> messageIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'markC2CMessageAsRead',
|
||||
_buildParam({
|
||||
"messageIDList": messageIDList,
|
||||
"userID": userID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 标记群聊消息已读
|
||||
/// [groupID] 群id
|
||||
/// [messageIDList] 消息clientMsgID集合
|
||||
Future markGroupMessageAsRead({
|
||||
required String groupID,
|
||||
required List<String> messageIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'markGroupMessageAsRead',
|
||||
_buildParam({
|
||||
"messageIDList": messageIDList,
|
||||
"groupID": groupID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 正在输入提示
|
||||
/// [msgTip] 自定义内容
|
||||
@@ -489,14 +455,22 @@ class MessageManager {
|
||||
/// 创建卡片消息
|
||||
/// [data] 自定义数据
|
||||
Future<Message> createCardMessage({
|
||||
required Map<String, dynamic> data,
|
||||
required String userID,
|
||||
required String nickname,
|
||||
String? faceURL,
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createCardMessage',
|
||||
_buildParam({
|
||||
'cardMessage': data,
|
||||
'cardMessage': {
|
||||
'userID': userID,
|
||||
'nickname': nickname,
|
||||
'faceURL': faceURL,
|
||||
'ex': ex,
|
||||
},
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
@@ -519,32 +493,6 @@ class MessageManager {
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// 清空单聊消息记录
|
||||
/// [uid] 单聊对象id
|
||||
Future<dynamic> clearC2CHistoryMessage({
|
||||
required String uid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearC2CHistoryMessage',
|
||||
_buildParam({
|
||||
"userID": uid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 清空组消息记录
|
||||
/// [gid] 组id
|
||||
Future<dynamic> clearGroupHistoryMessage({
|
||||
required String gid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearGroupHistoryMessage',
|
||||
_buildParam({
|
||||
"groupID": gid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 搜索消息
|
||||
/// [conversationID] 根据会话查询,如果是全局搜索传null
|
||||
/// [keywordList] 搜索关键词列表,目前仅支持一个关键词搜索
|
||||
@@ -587,134 +535,46 @@ class MessageManager {
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => SearchResult.fromJson(map)));
|
||||
|
||||
/// 删除本地跟服务器的指定的消息
|
||||
/// [message] 被删除的消息
|
||||
Future<dynamic> deleteMessageFromLocalAndSvr({
|
||||
required Message message,
|
||||
/// 撤回消息
|
||||
/// [message] 被撤回的消息体
|
||||
Future revokeMessage({
|
||||
required String conversationID,
|
||||
required String clientMsgID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteMessageFromLocalAndSvr',
|
||||
_buildParam(message.toJson()
|
||||
..addAll({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
})));
|
||||
|
||||
/// 删除本地所有聊天记录
|
||||
Future<dynamic> deleteAllMsgFromLocal({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteAllMsgFromLocal',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 删除本地跟服务器所有聊天记录
|
||||
Future<dynamic> deleteAllMsgFromLocalAndSvr({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteAllMsgFromLocalAndSvr',
|
||||
'revokeMessage',
|
||||
_buildParam({
|
||||
'conversationID': conversationID,
|
||||
'clientMsgID': clientMsgID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 标记消息已读
|
||||
/// [conversationID] 会话ID
|
||||
/// [messageIDList] 被标记的消息clientMsgID
|
||||
Future markMessageAsReadByConID({
|
||||
Future markMessagesAsReadByMsgID({
|
||||
required String conversationID,
|
||||
required List<String> messageIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'markMessageAsReadByConID',
|
||||
'markMessagesAsReadByMsgID',
|
||||
_buildParam({
|
||||
"messageIDList": messageIDList,
|
||||
"conversationID": conversationID,
|
||||
"messageIDList": messageIDList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 删除本地跟服务器的单聊聊天记录
|
||||
/// [uid] 聊天对象的userID
|
||||
Future<dynamic> clearC2CHistoryMessageFromLocalAndSvr({
|
||||
required String uid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearC2CHistoryMessageFromLocalAndSvr',
|
||||
_buildParam({
|
||||
"userID": uid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 删除本地跟服务器的群聊天记录
|
||||
/// [gid] 组id
|
||||
Future<dynamic> clearGroupHistoryMessageFromLocalAndSvr({
|
||||
required String gid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearGroupHistoryMessageFromLocalAndSvr',
|
||||
_buildParam({
|
||||
"groupID": gid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 获取聊天记录(以startMsg为节点,新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息
|
||||
/// [userID] 接收消息的用户id
|
||||
/// [conversationID] 会话id,查询通知时可用
|
||||
/// [groupID] 接收消息的组id
|
||||
/// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.last
|
||||
/// [count] 一次拉取的总数
|
||||
Future<List<Message>> getHistoryMessageListReverse({
|
||||
String? userID,
|
||||
String? groupID,
|
||||
String? conversationID,
|
||||
Message? startMsg,
|
||||
int? count,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getHistoryMessageListReverse',
|
||||
_buildParam({
|
||||
'userID': userID ?? '',
|
||||
'groupID': groupID ?? '',
|
||||
'conversationID': conversationID ?? '',
|
||||
'startClientMsgID': startMsg?.clientMsgID ?? '',
|
||||
'count': count ?? 10,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// 撤回消息
|
||||
/// [message] 被撤回的消息体
|
||||
Future revokeMessageV2({
|
||||
required Message message,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'newRevokeMessage',
|
||||
_buildParam(message.toJson()
|
||||
..addAll({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
})));
|
||||
|
||||
/// 获取聊天记录(以startMsg为节点,以前的聊天记录)
|
||||
/// [userID] 接收消息的用户id
|
||||
/// [conversationID] 会话id,查询通知时可用
|
||||
/// [groupID] 接收消息的组id
|
||||
/// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.first
|
||||
/// [count] 一次拉取的总数
|
||||
/// [lastMinSeq] 第一页消息不用传,获取第二页开始必传 跟[startMsg]一样
|
||||
Future<AdvancedMessage> getAdvancedHistoryMessageList({
|
||||
String? userID,
|
||||
String? groupID,
|
||||
String? conversationID,
|
||||
int? lastMinSeq,
|
||||
Message? startMsg,
|
||||
int? lastMinSeq,
|
||||
int? count,
|
||||
String? operationID,
|
||||
}) =>
|
||||
@@ -722,8 +582,30 @@ class MessageManager {
|
||||
.invokeMethod(
|
||||
'getAdvancedHistoryMessageList',
|
||||
_buildParam({
|
||||
'userID': userID ?? '',
|
||||
'groupID': groupID ?? '',
|
||||
'conversationID': conversationID ?? '',
|
||||
'startClientMsgID': startMsg?.clientMsgID ?? '',
|
||||
'count': count ?? 40,
|
||||
'lastMinSeq': lastMinSeq ?? 0,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
|
||||
|
||||
/// 获取聊天记录(以startMsg为节点,新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息
|
||||
/// [conversationID] 会话id,查询通知时可用
|
||||
/// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.last
|
||||
/// [count] 一次拉取的总数
|
||||
Future<AdvancedMessage> getAdvancedHistoryMessageListReverse({
|
||||
String? conversationID,
|
||||
Message? startMsg,
|
||||
int? lastMinSeq,
|
||||
int? count,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getAdvancedHistoryMessageListReverse',
|
||||
_buildParam({
|
||||
'conversationID': conversationID ?? '',
|
||||
'startClientMsgID': startMsg?.clientMsgID ?? '',
|
||||
'count': count ?? 40,
|
||||
@@ -876,7 +758,7 @@ class MessageManager {
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// 用户资料改变监听
|
||||
///
|
||||
Future setCustomBusinessListener(OnCustomBusinessListener listener) {
|
||||
this.customBusinessListener = listener;
|
||||
return _channel.invokeMethod('setCustomBusinessListener', _buildParam({}));
|
||||
|
||||
@@ -1,162 +1,162 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OrganizationManager {
|
||||
MethodChannel _channel;
|
||||
late OnOrganizationListener listener;
|
||||
|
||||
OrganizationManager(this._channel);
|
||||
|
||||
/// 组织架构发生变化回调
|
||||
Future setOrganizationListener(OnOrganizationListener listener) {
|
||||
this.listener = listener;
|
||||
return _channel.invokeMethod('setOrganizationListener', _buildParam({}));
|
||||
}
|
||||
|
||||
/// 获取子部门列表,返回当前部门下的一级子部门
|
||||
/// [departmentID] 当前部门id
|
||||
/// [offset] 开始下标
|
||||
/// [count] 每页大小
|
||||
Future<List<DeptInfo>> getSubDept({
|
||||
required String departmentID,
|
||||
int offset = 0,
|
||||
int count = 40,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getSubDepartment',
|
||||
_buildParam({
|
||||
'departmentID': departmentID,
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => DeptInfo.fromJson(v)));
|
||||
|
||||
/// 获取部门下的成员列表,返回当前部门下的一级成员
|
||||
/// [departmentID] 当前部门id
|
||||
/// [offset] 开始下标
|
||||
/// [count] 每页大小
|
||||
Future<List<DeptMemberInfo>> getDeptMember({
|
||||
required String departmentID,
|
||||
int offset = 0,
|
||||
int count = 40,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getDepartmentMember',
|
||||
_buildParam({
|
||||
'departmentID': departmentID,
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (v) => DeptMemberInfo.fromJson(v)));
|
||||
|
||||
/// 获取成员所在的部门
|
||||
/// [userID] 成员ID
|
||||
Future<List<UserInDept>> getUserInDept({
|
||||
required String userID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getUserInDepartment',
|
||||
_buildParam({
|
||||
'userID': userID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => UserInDept.fromJson(v)));
|
||||
|
||||
/// 获取部门下的子部门跟员工
|
||||
/// [departmentID] 当前部门id
|
||||
Future<DeptMemberAndSubDept> getDeptMemberAndSubDept({
|
||||
required String departmentID,
|
||||
// int departmentOffset = 0,
|
||||
// int departmentCount = 40,
|
||||
// int memberOffset = 0,
|
||||
// int memberCount = 40,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getDepartmentMemberAndSubDepartment',
|
||||
_buildParam({
|
||||
'departmentID': departmentID,
|
||||
// 'departmentOffset': departmentOffset,
|
||||
// 'departmentCount': departmentCount,
|
||||
// 'memberOffset': memberOffset,
|
||||
// 'memberCount': memberCount,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (v) => DeptMemberAndSubDept.fromJson(v)));
|
||||
|
||||
/// 查询部门信息
|
||||
/// [departmentID] 部门ID
|
||||
Future<DeptInfo> getDeptInfo({
|
||||
required String departmentID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getDepartmentInfo',
|
||||
_buildParam({
|
||||
'departmentID': departmentID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (v) => DeptInfo.fromJson(v)));
|
||||
|
||||
/// 搜索组织人员
|
||||
/// [keyWord] 关键字
|
||||
/// [isSearchUserName] 是否匹配用户名
|
||||
/// [isSearchEnglishName] 是否匹配英文名
|
||||
/// [isSearchPosition] 是否匹配职位
|
||||
/// [isSearchUserID] 是否匹配用户ID
|
||||
/// [isSearchMobile] 是否匹配手机号
|
||||
/// [isSearchEmail] 是否匹配邮箱号
|
||||
/// [isSearchTelephone] 是否匹配电话号码
|
||||
/// [offset] 开始下标
|
||||
/// [count] 分页大小
|
||||
Future<OrganizationSearchResult> searchOrganization({
|
||||
required String keyWord,
|
||||
bool isSearchUserName = false,
|
||||
bool isSearchEnglishName = false,
|
||||
bool isSearchPosition = false,
|
||||
bool isSearchUserID = false,
|
||||
bool isSearchMobile = false,
|
||||
bool isSearchEmail = false,
|
||||
bool isSearchTelephone = false,
|
||||
int offset = 0,
|
||||
int count = 40,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'searchOrganization',
|
||||
_buildParam({
|
||||
'searchParam': {
|
||||
'keyWord': keyWord,
|
||||
'isSearchUserName': isSearchUserName,
|
||||
'isSearchEnglishName': isSearchEnglishName,
|
||||
'isSearchPosition': isSearchPosition,
|
||||
'isSearchUserID': isSearchUserID,
|
||||
'isSearchMobile': isSearchMobile,
|
||||
'isSearchEmail': isSearchEmail,
|
||||
'isSearchTelephone': isSearchTelephone,
|
||||
},
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (v) => OrganizationSearchResult.fromJson(v)));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "organizationManager";
|
||||
return param;
|
||||
}
|
||||
}
|
||||
// import 'package:flutter/services.dart';
|
||||
// import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
//
|
||||
// class OrganizationManager {
|
||||
// MethodChannel _channel;
|
||||
// late OnOrganizationListener listener;
|
||||
//
|
||||
// OrganizationManager(this._channel);
|
||||
//
|
||||
// /// 组织架构发生变化回调
|
||||
// Future setOrganizationListener(OnOrganizationListener listener) {
|
||||
// this.listener = listener;
|
||||
// return _channel.invokeMethod('setOrganizationListener', _buildParam({}));
|
||||
// }
|
||||
//
|
||||
// /// 获取子部门列表,返回当前部门下的一级子部门
|
||||
// /// [departmentID] 当前部门id
|
||||
// /// [offset] 开始下标
|
||||
// /// [count] 每页大小
|
||||
// Future<List<DeptInfo>> getSubDept({
|
||||
// required String departmentID,
|
||||
// int offset = 0,
|
||||
// int count = 40,
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel
|
||||
// .invokeMethod(
|
||||
// 'getSubDepartment',
|
||||
// _buildParam({
|
||||
// 'departmentID': departmentID,
|
||||
// 'offset': offset,
|
||||
// 'count': count,
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }))
|
||||
// .then((value) => Utils.toList(value, (v) => DeptInfo.fromJson(v)));
|
||||
//
|
||||
// /// 获取部门下的成员列表,返回当前部门下的一级成员
|
||||
// /// [departmentID] 当前部门id
|
||||
// /// [offset] 开始下标
|
||||
// /// [count] 每页大小
|
||||
// Future<List<DeptMemberInfo>> getDeptMember({
|
||||
// required String departmentID,
|
||||
// int offset = 0,
|
||||
// int count = 40,
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel
|
||||
// .invokeMethod(
|
||||
// 'getDepartmentMember',
|
||||
// _buildParam({
|
||||
// 'departmentID': departmentID,
|
||||
// 'offset': offset,
|
||||
// 'count': count,
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }))
|
||||
// .then((value) =>
|
||||
// Utils.toList(value, (v) => DeptMemberInfo.fromJson(v)));
|
||||
//
|
||||
// /// 获取成员所在的部门
|
||||
// /// [userID] 成员ID
|
||||
// Future<List<UserInDept>> getUserInDept({
|
||||
// required String userID,
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel
|
||||
// .invokeMethod(
|
||||
// 'getUserInDepartment',
|
||||
// _buildParam({
|
||||
// 'userID': userID,
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }))
|
||||
// .then((value) => Utils.toList(value, (v) => UserInDept.fromJson(v)));
|
||||
//
|
||||
// /// 获取部门下的子部门跟员工
|
||||
// /// [departmentID] 当前部门id
|
||||
// Future<DeptMemberAndSubDept> getDeptMemberAndSubDept({
|
||||
// required String departmentID,
|
||||
// // int departmentOffset = 0,
|
||||
// // int departmentCount = 40,
|
||||
// // int memberOffset = 0,
|
||||
// // int memberCount = 40,
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel
|
||||
// .invokeMethod(
|
||||
// 'getDepartmentMemberAndSubDepartment',
|
||||
// _buildParam({
|
||||
// 'departmentID': departmentID,
|
||||
// // 'departmentOffset': departmentOffset,
|
||||
// // 'departmentCount': departmentCount,
|
||||
// // 'memberOffset': memberOffset,
|
||||
// // 'memberCount': memberCount,
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }))
|
||||
// .then((value) =>
|
||||
// Utils.toObj(value, (v) => DeptMemberAndSubDept.fromJson(v)));
|
||||
//
|
||||
// /// 查询部门信息
|
||||
// /// [departmentID] 部门ID
|
||||
// Future<DeptInfo> getDeptInfo({
|
||||
// required String departmentID,
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel
|
||||
// .invokeMethod(
|
||||
// 'getDepartmentInfo',
|
||||
// _buildParam({
|
||||
// 'departmentID': departmentID,
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }))
|
||||
// .then((value) => Utils.toObj(value, (v) => DeptInfo.fromJson(v)));
|
||||
//
|
||||
// /// 搜索组织人员
|
||||
// /// [keyWord] 关键字
|
||||
// /// [isSearchUserName] 是否匹配用户名
|
||||
// /// [isSearchEnglishName] 是否匹配英文名
|
||||
// /// [isSearchPosition] 是否匹配职位
|
||||
// /// [isSearchUserID] 是否匹配用户ID
|
||||
// /// [isSearchMobile] 是否匹配手机号
|
||||
// /// [isSearchEmail] 是否匹配邮箱号
|
||||
// /// [isSearchTelephone] 是否匹配电话号码
|
||||
// /// [offset] 开始下标
|
||||
// /// [count] 分页大小
|
||||
// Future<OrganizationSearchResult> searchOrganization({
|
||||
// required String keyWord,
|
||||
// bool isSearchUserName = false,
|
||||
// bool isSearchEnglishName = false,
|
||||
// bool isSearchPosition = false,
|
||||
// bool isSearchUserID = false,
|
||||
// bool isSearchMobile = false,
|
||||
// bool isSearchEmail = false,
|
||||
// bool isSearchTelephone = false,
|
||||
// int offset = 0,
|
||||
// int count = 40,
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel
|
||||
// .invokeMethod(
|
||||
// 'searchOrganization',
|
||||
// _buildParam({
|
||||
// 'searchParam': {
|
||||
// 'keyWord': keyWord,
|
||||
// 'isSearchUserName': isSearchUserName,
|
||||
// 'isSearchEnglishName': isSearchEnglishName,
|
||||
// 'isSearchPosition': isSearchPosition,
|
||||
// 'isSearchUserID': isSearchUserID,
|
||||
// 'isSearchMobile': isSearchMobile,
|
||||
// 'isSearchEmail': isSearchEmail,
|
||||
// 'isSearchTelephone': isSearchTelephone,
|
||||
// },
|
||||
// 'offset': offset,
|
||||
// 'count': count,
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }))
|
||||
// .then((value) =>
|
||||
// Utils.toObj(value, (v) => OrganizationSearchResult.fromJson(v)));
|
||||
//
|
||||
// static Map _buildParam(Map param) {
|
||||
// param["ManagerName"] = "organizationManager";
|
||||
// return param;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -14,16 +14,16 @@ class UserManager {
|
||||
}
|
||||
|
||||
/// 获取用户资料
|
||||
/// [uidList] 用户ID列表
|
||||
/// [userIDList] 用户ID列表
|
||||
Future<List<UserInfo>> getUsersInfo({
|
||||
required List<String> uidList,
|
||||
required List<String> userIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getUsersInfo',
|
||||
_buildParam({
|
||||
'uidList': uidList,
|
||||
'userIDList': userIDList,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class WorkMomentsManager {
|
||||
MethodChannel _channel;
|
||||
late OnWorkMomentsListener listener;
|
||||
|
||||
WorkMomentsManager(this._channel);
|
||||
|
||||
/// 朋友圈信息发送变化通知
|
||||
Future setWorkMomentsListener(OnWorkMomentsListener listener) {
|
||||
this.listener = listener;
|
||||
return _channel.invokeMethod('setWorkMomentsListener', _buildParam({}));
|
||||
}
|
||||
|
||||
/// 获取朋友圈未读消息总数
|
||||
Future<int> getWorkMomentsUnReadCount({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getWorkMomentsUnReadCount',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => map['unreadCount']));
|
||||
|
||||
/// 获取通知列表
|
||||
/// [offset] 开始下标
|
||||
/// [count] 每页大小
|
||||
Future<List<WorkMomentsInfo>> getWorkMomentsNotification({
|
||||
required int offset,
|
||||
required int count,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getWorkMomentsNotification',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => WorkMomentsInfo.fromJson(map)));
|
||||
|
||||
/// 清除通知列表
|
||||
Future clearWorkMomentsNotification({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearWorkMomentsNotification',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "workMomentsManager";
|
||||
return param;
|
||||
}
|
||||
}
|
||||
// import 'package:flutter/services.dart';
|
||||
// import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
//
|
||||
// class WorkMomentsManager {
|
||||
// MethodChannel _channel;
|
||||
// late OnWorkMomentsListener listener;
|
||||
//
|
||||
// WorkMomentsManager(this._channel);
|
||||
//
|
||||
// /// 朋友圈信息发送变化通知
|
||||
// Future setWorkMomentsListener(OnWorkMomentsListener listener) {
|
||||
// this.listener = listener;
|
||||
// return _channel.invokeMethod('setWorkMomentsListener', _buildParam({}));
|
||||
// }
|
||||
//
|
||||
// /// 获取朋友圈未读消息总数
|
||||
// Future<int> getWorkMomentsUnReadCount({
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel
|
||||
// .invokeMethod(
|
||||
// 'getWorkMomentsUnReadCount',
|
||||
// _buildParam({
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }))
|
||||
// .then((value) => Utils.toObj(value, (map) => map['unreadCount']));
|
||||
//
|
||||
// /// 获取通知列表
|
||||
// /// [offset] 开始下标
|
||||
// /// [count] 每页大小
|
||||
// Future<List<WorkMomentsInfo>> getWorkMomentsNotification({
|
||||
// required int offset,
|
||||
// required int count,
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel
|
||||
// .invokeMethod(
|
||||
// 'getWorkMomentsNotification',
|
||||
// _buildParam({
|
||||
// 'offset': offset,
|
||||
// 'count': count,
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }))
|
||||
// .then((value) =>
|
||||
// Utils.toList(value, (map) => WorkMomentsInfo.fromJson(map)));
|
||||
//
|
||||
// /// 清除通知列表
|
||||
// Future clearWorkMomentsNotification({
|
||||
// String? operationID,
|
||||
// }) =>
|
||||
// _channel.invokeMethod(
|
||||
// 'clearWorkMomentsNotification',
|
||||
// _buildParam({
|
||||
// 'operationID': Utils.checkOperationID(operationID),
|
||||
// }));
|
||||
//
|
||||
// static Map _buildParam(Map param) {
|
||||
// param["ManagerName"] = "workMomentsManager";
|
||||
// return param;
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user