This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
import '../models/update_req.dart';
|
||||
|
||||
class ConversationManager {
|
||||
MethodChannel _channel;
|
||||
late OnConversationListener listener;
|
||||
@@ -98,14 +101,11 @@ class ConversationManager {
|
||||
required String conversationID,
|
||||
required bool isPinned,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'pinConversation',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isPinned": isPinned,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(isPinned: isPinned);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Hide a Conversation
|
||||
/// [conversationID] Conversation ID
|
||||
@@ -161,22 +161,20 @@ class ConversationManager {
|
||||
/// Message Do-Not-Disturb Setting
|
||||
/// [conversationID] Conversation ID
|
||||
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future<dynamic> setConversationRecvMessageOpt({
|
||||
required String conversationID,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationRecvMessageOpt',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"status": status,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(recvMsgOpt: status);
|
||||
|
||||
/// 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
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Message Do-Not-Disturb Setting
|
||||
/// [conversationID] Conversation ID
|
||||
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
|
||||
Future<List<dynamic>> getConversationRecvMessageOpt({
|
||||
required List<String> conversationIDList,
|
||||
String? operationID,
|
||||
@@ -193,18 +191,16 @@ class ConversationManager {
|
||||
/// Self-Destruct Messages
|
||||
/// [conversationID] Conversation ID
|
||||
/// [isPrivate] true: enable, false: disable
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future<dynamic> setConversationPrivateChat({
|
||||
required String conversationID,
|
||||
required bool isPrivate,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationPrivateChat',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isPrivate": isPrivate,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(isPrivateChat: isPrivate);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Delete a Conversation Locally and from the Server
|
||||
/// [conversationID] Conversation ID
|
||||
@@ -245,16 +241,15 @@ class ConversationManager {
|
||||
|
||||
/// Reset Mentioned (Group At) Flags [GroupAtType]
|
||||
/// [conversationID] Conversation ID
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future<dynamic> resetConversationGroupAtType({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'resetConversationGroupAtType',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(groupAtType: 0);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Query @ All Flag
|
||||
Future<dynamic> getAtAllTag({
|
||||
@@ -271,32 +266,27 @@ class ConversationManager {
|
||||
|
||||
/// Global Do-Not-Disturb
|
||||
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
|
||||
@Deprecated('use [OpenIM.iMManager.userManager.setSelfInfo()] instead')
|
||||
Future<dynamic> setGlobalRecvMessageOpt({
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGlobalRecvMessageOpt',
|
||||
_buildParam({
|
||||
"status": status,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
throw UnimplementedError('setGlobalRecvMessageOpt');
|
||||
}
|
||||
|
||||
/// Set Self-Destruct Message Duration
|
||||
/// [conversationID] Conversation ID
|
||||
/// [burnDuration] Duration in seconds, default: 30s
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future<dynamic> setConversationBurnDuration({
|
||||
required String conversationID,
|
||||
int burnDuration = 30,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationBurnDuration',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"burnDuration": burnDuration,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(burnDuration: burnDuration);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Mark Messages as Read
|
||||
/// [conversationID] Conversation ID
|
||||
@@ -311,36 +301,6 @@ class ConversationManager {
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Enable Regular Deletion
|
||||
/// [isMsgDestruct] true: enable
|
||||
Future<dynamic> setConversationIsMsgDestruct({
|
||||
required String conversationID,
|
||||
bool isMsgDestruct = true,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationIsMsgDestruct',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isMsgDestruct": isMsgDestruct,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Regularly Delete Chat Records
|
||||
/// [duration] Seconds
|
||||
Future<dynamic> setConversationMsgDestructTime({
|
||||
required String conversationID,
|
||||
int duration = 1 * 24 * 60 * 60,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationMsgDestructTime',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"duration": duration,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// search Conversations
|
||||
Future<List<ConversationInfo>> searchConversations(
|
||||
String name, {
|
||||
@@ -356,18 +316,15 @@ class ConversationManager {
|
||||
.then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future setConversationEx(
|
||||
String conversationID, {
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setConversationEx',
|
||||
_buildParam({
|
||||
'conversationID': conversationID,
|
||||
'ex': ex,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
final req = ConversationReq(ex: ex);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Custom Sort for Conversation List
|
||||
@@ -424,14 +381,34 @@ class ConversationManager {
|
||||
),
|
||||
)
|
||||
.then((value) {
|
||||
print('getInputStates: $value');
|
||||
final result = Utils.toListMap(value);
|
||||
return List<int>.from(result);
|
||||
});
|
||||
}
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
Future setConversation(
|
||||
String conversationID,
|
||||
ConversationReq req, {
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setConversation',
|
||||
_buildParam(
|
||||
{
|
||||
'conversationID': conversationID,
|
||||
'req': req.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "conversationManager";
|
||||
param = Utils.cleanMap(param);
|
||||
log('param: $param');
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
import '../models/update_req.dart';
|
||||
|
||||
class FriendshipManager {
|
||||
MethodChannel _channel;
|
||||
late OnFriendshipListener listener;
|
||||
@@ -15,8 +19,9 @@ class FriendshipManager {
|
||||
|
||||
/// Query Friend Information
|
||||
/// [userIDList] List of user IDs
|
||||
Future<List<FullUserInfo>> getFriendsInfo({
|
||||
Future<List<PublicUserInfo>> getFriendsInfo({
|
||||
required List<String> userIDList,
|
||||
bool filterBlack = false,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
@@ -24,9 +29,10 @@ class FriendshipManager {
|
||||
'getFriendsInfo',
|
||||
_buildParam({
|
||||
"userIDList": userIDList,
|
||||
'filterBlack': filterBlack,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
|
||||
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
|
||||
|
||||
/// Send a Friend Request, the other party needs to accept the request to become friends.
|
||||
/// [userID] User ID to be invited
|
||||
@@ -63,23 +69,35 @@ 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<FullUserInfo>> getFriendList({String? operationID}) => _channel
|
||||
.invokeMethod(
|
||||
'getFriendList',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
|
||||
Future<List<PublicUserInfo>> getFriendList({
|
||||
String? operationID,
|
||||
bool filterBlack = false,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getFriendList',
|
||||
_buildParam({
|
||||
'filterBlack': filterBlack,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
|
||||
|
||||
Future<List<FullUserInfo>> getFriendListPage({String? operationID, int offset = 0, int count = 40}) => _channel
|
||||
.invokeMethod(
|
||||
'getFriendListPage',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
|
||||
Future<List<PublicUserInfo>> getFriendListPage({
|
||||
bool filterBlack = false,
|
||||
int offset = 0,
|
||||
int count = 40,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getFriendListPage',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'filterBlack': filterBlack,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
|
||||
|
||||
/// Get Friend List, including friends who have been put into the blacklist (returns a map)
|
||||
Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel
|
||||
@@ -90,31 +108,36 @@ class FriendshipManager {
|
||||
}))
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
Future<List<dynamic>> getFriendListPageMap({String? operationID, int offset = 0, int count = 40}) => _channel
|
||||
.invokeMethod(
|
||||
'getFriendListPage',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toListMap(value));
|
||||
Future<List<dynamic>> getFriendListPageMap({
|
||||
bool filterBlack = false,
|
||||
String? operationID,
|
||||
int offset = 0,
|
||||
int count = 40,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getFriendListPage',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'filterBlack': filterBlack,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
/// Set Friend's Remark
|
||||
/// [userID] Friend's userID
|
||||
/// [remark] Friend's remark
|
||||
@Deprecated('Use [updateFriends] instead')
|
||||
Future<dynamic> setFriendRemark({
|
||||
required String userID,
|
||||
required String remark,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setFriendRemark',
|
||||
_buildParam({
|
||||
'toUserID': userID,
|
||||
'remark': remark,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = UpdateFriendsReq(friendUserIDs: [userID], remark: remark);
|
||||
|
||||
return updateFriends(req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Add to Blacklist
|
||||
/// [userID] Friend's ID to be added to the blacklist
|
||||
@@ -239,22 +262,35 @@ class FriendshipManager {
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => SearchFriendsInfo.fromJson(map)));
|
||||
|
||||
Future<String?> setFriendsEx(
|
||||
@Deprecated('Use [updateFriends] instead')
|
||||
Future setFriendsEx(
|
||||
List<String> friendIDs, {
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setFriendsEx',
|
||||
_buildParam({
|
||||
"friendIDs": friendIDs,
|
||||
"ex": ex,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
final req = UpdateFriendsReq(friendUserIDs: friendIDs, ex: ex);
|
||||
|
||||
return updateFriends(req, operationID: operationID);
|
||||
}
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
Future<dynamic> updateFriends(
|
||||
UpdateFriendsReq updateFriendsReq, {
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'updateFriends',
|
||||
_buildParam({
|
||||
'req': updateFriendsReq.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => value);
|
||||
}
|
||||
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "friendshipManager";
|
||||
param = Utils.cleanMap(param);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:developer';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:flutter_openim_sdk/src/models/set_group_member_info.dart';
|
||||
|
||||
class GroupManager {
|
||||
MethodChannel _channel;
|
||||
@@ -18,39 +19,43 @@ class GroupManager {
|
||||
/// Invite users to a group, allowing them to join without approval.
|
||||
/// [groupID] Group ID
|
||||
/// [userIDList] List of user IDs
|
||||
Future inviteUserToGroup({
|
||||
Future<List<GroupInviteResult>> inviteUserToGroup({
|
||||
required String groupID,
|
||||
required List<String> userIDList,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'inviteUserToGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'inviteUserToGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
|
||||
|
||||
/// Remove group members
|
||||
/// [groupID] Group ID
|
||||
/// [userIDList] List of user IDs
|
||||
/// [reason] Reason for removal
|
||||
Future kickGroupMember({
|
||||
Future<List<GroupInviteResult>> kickGroupMember({
|
||||
required String groupID,
|
||||
required List<String> userIDList,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'kickGroupMember',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'kickGroupMember',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
|
||||
|
||||
/// Query group member information
|
||||
/// [groupID] Group ID
|
||||
@@ -213,15 +218,17 @@ class GroupManager {
|
||||
|
||||
/// 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, String? operationID, int joinSource = 3, String? ex}) => _channel.invokeMethod(
|
||||
'joinGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'reason': reason,
|
||||
'joinSource': joinSource,
|
||||
'ex': ex,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
Future<dynamic> joinGroup(
|
||||
{required String groupID, String? reason, String? operationID, int joinSource = 3, String? ex}) =>
|
||||
_channel.invokeMethod(
|
||||
'joinGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'reason': reason,
|
||||
'joinSource': joinSource,
|
||||
'ex': ex,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Exit a group
|
||||
Future<dynamic> quitGroup({
|
||||
@@ -357,20 +364,17 @@ class GroupManager {
|
||||
/// [groupID] Group ID
|
||||
/// [userID] User ID of the group member
|
||||
/// [groupNickname] Group nickname
|
||||
@Deprecated('Use [setGroupMemberInfo] instead')
|
||||
Future<dynamic> setGroupMemberNickname({
|
||||
required String groupID,
|
||||
required String userID,
|
||||
String? groupNickname,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupMemberNickname',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'groupNickname': groupNickname ?? '',
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = SetGroupMemberInfo(groupID: groupID, userID: userID, nickname: groupNickname);
|
||||
|
||||
return setGroupMemberInfo(groupMembersInfo: req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Query a group
|
||||
/// [keywordList] Search keywords; currently, only one keyword is supported, and it cannot be empty.
|
||||
@@ -399,20 +403,17 @@ class GroupManager {
|
||||
/// [groupID] Group ID
|
||||
/// [userID] User ID of the group member
|
||||
/// [roleLevel] Role level; see [GroupRoleLevel]
|
||||
@Deprecated('Use [setGroupMemberInfo] instead')
|
||||
Future<dynamic> setGroupMemberRoleLevel({
|
||||
required String groupID,
|
||||
required String userID,
|
||||
required int roleLevel,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupMemberRoleLevel',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'roleLevel': roleLevel,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = SetGroupMemberInfo(groupID: groupID, userID: userID, roleLevel: roleLevel);
|
||||
|
||||
return setGroupMemberInfo(groupMembersInfo: req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Get a group member list based on join time
|
||||
Future<List<GroupMembersInfo>> getGroupMemberListByJoinTime({
|
||||
@@ -441,50 +442,44 @@ class GroupManager {
|
||||
/// Set group verification for joining
|
||||
/// [groupID] Group ID
|
||||
/// [needVerification] Verification setting; see [GroupVerification] class
|
||||
@Deprecated('Use [setGroupInfo] instead')
|
||||
Future<dynamic> setGroupVerification({
|
||||
required String groupID,
|
||||
required int needVerification,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupVerification',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'needVerification': needVerification,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = GroupInfo(groupID: groupID, needVerification: needVerification);
|
||||
|
||||
/// 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,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupLookMemberInfo',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'status': status,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
return setGroupInfo(req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Allow/disallow members to add friends through the group
|
||||
/// [groupID] Group ID
|
||||
/// [status] 0: Disable, 1: Enable
|
||||
@Deprecated('Use [setGroupInfo] instead')
|
||||
Future<dynamic> setGroupLookMemberInfo({
|
||||
required String groupID,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) {
|
||||
final req = GroupInfo(groupID: groupID, lookMemberInfo: status);
|
||||
|
||||
return setGroupInfo(req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Allow/disallow members to add friends through the group
|
||||
/// [groupID] Group ID
|
||||
/// [status] 0: Disable, 1: Enable
|
||||
@Deprecated('Use [setGroupInfo] instead')
|
||||
Future<dynamic> setGroupApplyMemberFriend({
|
||||
required String groupID,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupApplyMemberFriend',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'status': status,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = GroupInfo(groupID: groupID, applyMemberFriend: status);
|
||||
|
||||
return setGroupInfo(req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Get group owners and administrators
|
||||
/// [groupId] Group ID
|
||||
@@ -567,7 +562,7 @@ class GroupManager {
|
||||
|
||||
/// Modify the GroupMemberInfo ex field
|
||||
Future<dynamic> setGroupMemberInfo({
|
||||
required GroupMembersInfo groupMembersInfo,
|
||||
required SetGroupMemberInfo groupMembersInfo,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
@@ -590,9 +585,13 @@ class GroupManager {
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "groupManager";
|
||||
param = Utils.cleanMap(param);
|
||||
log('param: $param');
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
@@ -141,18 +142,6 @@ class IMManager {
|
||||
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 '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);
|
||||
break;
|
||||
|
||||
case 'onRecvNewMessage':
|
||||
var value = call.arguments['data']['message'];
|
||||
final msg = Utils.toObj(value, (map) => Message.fromJson(map));
|
||||
@@ -367,10 +356,8 @@ class IMManager {
|
||||
OnConnectListener listener, {
|
||||
String? operationID,
|
||||
}) {
|
||||
this._connectListener = listener;
|
||||
if (config.logFilePath == null) {
|
||||
config.logFilePath = config.dataDir;
|
||||
}
|
||||
_connectListener = listener;
|
||||
config.logFilePath ??= config.dataDir;
|
||||
return _channel.invokeMethod(
|
||||
'initSDK',
|
||||
_buildParam(
|
||||
@@ -387,7 +374,6 @@ class IMManager {
|
||||
/// [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
|
||||
@@ -398,12 +384,13 @@ class IMManager {
|
||||
required String dataDir,
|
||||
required OnConnectListener listener,
|
||||
int logLevel = 6,
|
||||
bool isNeedEncryption = false,
|
||||
bool isCompression = false,
|
||||
bool isLogStandardOutput = true,
|
||||
String? logFilePath,
|
||||
String? operationID,
|
||||
}) {
|
||||
this._connectListener = listener;
|
||||
_connectListener = listener;
|
||||
return _channel.invokeMethod(
|
||||
'initSDK',
|
||||
_buildParam(
|
||||
@@ -414,8 +401,10 @@ class IMManager {
|
||||
"dataDir": dataDir,
|
||||
"logLevel": logLevel,
|
||||
"isCompression": isCompression,
|
||||
'isNeedEncryption': isNeedEncryption,
|
||||
"isLogStandardOutput": isLogStandardOutput,
|
||||
"logFilePath": logFilePath,
|
||||
'systemType': 'flutter',
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
},
|
||||
),
|
||||
@@ -535,7 +524,7 @@ class IMManager {
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 上传日志
|
||||
/// Upload logs
|
||||
Future uploadLogs({
|
||||
String? ex,
|
||||
int line = 0,
|
||||
@@ -549,6 +538,27 @@ class IMManager {
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
Future logs({
|
||||
int logLevel = 5,
|
||||
String? file,
|
||||
int line = 0,
|
||||
String? msgs,
|
||||
String? err,
|
||||
List<dynamic>? keyAndValues,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'logs',
|
||||
_buildParam({
|
||||
'line': line,
|
||||
'logLevel': logLevel,
|
||||
'file': file,
|
||||
'msgs': msgs,
|
||||
'err': err,
|
||||
if (keyAndValues != null) 'keyAndValue': jsonEncode(keyAndValues),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
void setUploadLogsListener(OnUploadLogsListener listener) {
|
||||
_uploadLogsListener = listener;
|
||||
}
|
||||
@@ -569,8 +579,10 @@ class IMManager {
|
||||
|
||||
MethodChannel get channel => _channel;
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "imManager";
|
||||
param = Utils.cleanMap(param);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,18 +147,14 @@ class MessageManager {
|
||||
|
||||
/// Typing status update
|
||||
/// [msgTip] Custom content
|
||||
@Deprecated('Use [OpenIM.iMManager.conversationManager.changeInputStates(conversationID:focus:)] instead')
|
||||
Future typingStatusUpdate({
|
||||
required String userID,
|
||||
String? msgTip,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'typingStatusUpdate',
|
||||
_buildParam({
|
||||
"msgTip": msgTip,
|
||||
"userID": userID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
throw UnimplementedError('typingStatusUpdate');
|
||||
}
|
||||
|
||||
/// Create a text message
|
||||
Future<Message> createTextMessage({
|
||||
@@ -551,6 +547,7 @@ class MessageManager {
|
||||
/// Mark messages as read
|
||||
/// [conversationID] Conversation ID
|
||||
/// [messageIDList] List of clientMsgIDs of messages to be marked as read
|
||||
@Deprecated('Use markConversationMessageAsRead instead')
|
||||
Future markMessagesAsReadByMsgID({
|
||||
required String conversationID,
|
||||
required List<String> messageIDList,
|
||||
@@ -791,8 +788,10 @@ class MessageManager {
|
||||
}));
|
||||
}
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "messageManager";
|
||||
param = Utils.cleanMap(param);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class UserManager {
|
||||
|
||||
/// Get user information
|
||||
/// [userIDList] List of user IDs
|
||||
Future<List<FullUserInfo>> getUsersInfo({
|
||||
Future<List<PublicUserInfo>> getUsersInfo({
|
||||
required List<String> userIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
@@ -26,7 +26,7 @@ class UserManager {
|
||||
'userIDList': userIDList,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
|
||||
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
|
||||
|
||||
/// Get information of the currently logged-in user
|
||||
Future<UserInfo> getSelfUserInfo({
|
||||
@@ -48,17 +48,16 @@ class UserManager {
|
||||
Future<String?> setSelfInfo({
|
||||
String? nickname,
|
||||
String? faceURL,
|
||||
int? appManagerLevel,
|
||||
int? globalRecvMsgOpt,
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setSelfInfo',
|
||||
_buildParam({
|
||||
// 'userID': userID,
|
||||
'nickname': nickname,
|
||||
'faceURL': faceURL,
|
||||
'appManagerLevel': appManagerLevel,
|
||||
'globalRecvMsgOpt': globalRecvMsgOpt,
|
||||
'ex': ex,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
@@ -115,37 +114,28 @@ class UserManager {
|
||||
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
Future<List<FullUserInfo>> getUsersInfoWithCache(
|
||||
@Deprecated('Use [getUsersInfo] instead')
|
||||
Future<List<PublicUserInfo>> getUsersInfoWithCache(
|
||||
List<String> userIDs, {
|
||||
String? groupID,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'getUsersInfoWithCache',
|
||||
_buildParam({
|
||||
'userIDs': userIDs,
|
||||
'groupID': groupID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => FullUserInfo.fromJson(map)));
|
||||
return getUsersInfo(userIDList: userIDs, operationID: operationID);
|
||||
}
|
||||
|
||||
/*
|
||||
Future<String?> setSelfUserInfoEx(
|
||||
UserInfo userInfo, {
|
||||
/// Global Do Not Disturb
|
||||
/// [status] 0: Normal; 1: Do not accept messages; 2: Accept online messages but not offline messages;
|
||||
@Deprecated('use [setSelfInfo] instead')
|
||||
Future<dynamic> setGlobalRecvMessageOpt({
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setSelfUserInfoEx',
|
||||
_buildParam({
|
||||
...userInfo.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
return setSelfInfo(globalRecvMsgOpt: status);
|
||||
}
|
||||
*/
|
||||
static Map _buildParam(Map param) {
|
||||
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "userManager";
|
||||
param = Utils.cleanMap(param);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user