fix: Fixed some issues.

This commit is contained in:
Brett
2023-10-17 16:09:19 +08:00
parent d07495fff6
commit 67251ae7ea
9 changed files with 175 additions and 51 deletions

View File

@@ -203,7 +203,7 @@ class FriendshipManager {
/// [isSearchUserID] Whether to search for friend IDs with keywords (note: cannot be false at the same time), defaults to false if empty
/// [isSearchNickname] Whether to search by nickname with keywords, defaults to false if empty
/// [isSearchRemark] Whether to search by remark name with keywords, defaults to false if empty
Future<List<FriendInfo>> searchFriends({
Future<List<SearchFriendInfo>> searchFriends({
List<String> keywordList = const [],
bool isSearchUserID = false,
bool isSearchNickname = false,
@@ -223,7 +223,7 @@ class FriendshipManager {
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => FriendInfo.fromJson(map)));
Utils.toList(value, (map) => SearchFriendInfo.fromJson(map)));
static Map _buildParam(Map param) {
param["ManagerName"] = "friendshipManager";

View File

@@ -33,7 +33,8 @@ class GroupManager {
'reason': reason,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
/// Remove group members
/// [groupID] Group ID
@@ -54,7 +55,8 @@ class GroupManager {
'reason': reason,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
/// Query group member information
/// [groupID] Group ID
@@ -72,7 +74,8 @@ class GroupManager {
'userIDList': userIDList,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// Paginate and retrieve the group member list
/// [groupID] Group ID
@@ -96,7 +99,8 @@ class GroupManager {
'count': count,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// Paginate and retrieve the group member list as a map
/// [groupID] Group ID
@@ -177,7 +181,8 @@ class GroupManager {
'ownerUserID': ownerUserID,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map)));
.then(
(value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map)));
/// Edit group information
Future<dynamic> setGroupInfo({
@@ -221,7 +226,8 @@ class GroupManager {
'groupIDList': groupIDList,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
.then(
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// Apply to join a group, requiring approval from an administrator or the group.
/// [joinSource] 2: Invited, 3: Searched, 4: Using a QR code
@@ -269,22 +275,28 @@ class GroupManager {
}));
/// Handle group membership applications received as a group owner or administrator
Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient({String? operationID}) => _channel
.invokeMethod(
'getGroupApplicationListAsRecipient',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient(
{String? operationID}) =>
_channel
.invokeMethod(
'getGroupApplicationListAsRecipient',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
/// Get the list of group membership applications sent by the user
Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant({String? operationID}) => _channel
.invokeMethod(
'getGroupApplicationListAsApplicant',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant(
{String? operationID}) =>
_channel
.invokeMethod(
'getGroupApplicationListAsApplicant',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
/// Accept a group membership application as an administrator or group owner
/// Note: Membership applications require approval from administrators or the group.
@@ -410,7 +422,8 @@ class GroupManager {
},
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
.then(
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// Set group member role
/// [groupID] Group ID
@@ -453,7 +466,8 @@ class GroupManager {
'excludeUserIDList': excludeUserIDList,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// Set group verification for joining
/// [groupID] Group ID
@@ -516,7 +530,8 @@ class GroupManager {
'groupID': groupID,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// Search for group members
/// [groupID] Group ID
@@ -548,7 +563,8 @@ class GroupManager {
},
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// Query a group
/// [groupID] Group ID

View File

@@ -362,6 +362,26 @@ class IMManager {
});
}
Future<bool?> init(
InitConfig config,
OnConnectListener listener, {
String? operationID,
}) {
this._connectListener = listener;
if (config.logFilePath == null) {
config.logFilePath = config.dataDir;
}
return _channel.invokeMethod(
'initSDK',
_buildParam(
{
...config.toMap(),
"operationID": Utils.checkOperationID(operationID),
},
),
);
}
/// Initialize the SDK
/// [platform] Platform ID [IMPlatform]
/// [apiAddr] SDK API address

View File

@@ -52,11 +52,7 @@ class UserManager {
Future<String?> setSelfInfo({
String? nickname,
String? faceURL,
int? gender,
int? appManagerLevel,
String? phoneNumber,
int? birth,
String? email,
String? ex,
String? operationID,
}) =>
@@ -66,11 +62,7 @@ class UserManager {
// 'userID': userID,
'nickname': nickname,
'faceURL': faceURL,
'gender': gender,
'appManagerLevel': appManagerLevel,
'phoneNumber': phoneNumber,
'birth': birth,
'email': email,
'ex': ex,
'operationID': Utils.checkOperationID(operationID),
}));