fix: Fixed some parameter errors.

main
Brett 1 year ago
parent bf9cd3ca21
commit a4b52f5895
  1. 4
      lib/src/manager/im_friendship_manager.dart
  2. 2
      lib/src/manager/im_group_manager.dart
  3. 8
      lib/src/manager/im_user_manager.dart
  4. 16
      lib/src/models/user_info.dart

@ -63,13 +63,13 @@ 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<FriendInfo>> getFriendList({String? operationID}) => _channel
Future<List<FullUserInfo>> getFriendList({String? operationID}) => _channel
.invokeMethod(
'getFriendList',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => FriendInfo.fromJson(v)));
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
/// Get Friend List, including friends who have been put into the blacklist (returns a map)
Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel

@ -566,8 +566,6 @@ class GroupManager {
/// Modify the GroupMemberInfo ex field
Future<dynamic> setGroupMemberInfo({
required String groupID,
required String userID,
required GroupMembersInfo groupMembersInfo,
String? operationID,
}) =>

@ -15,7 +15,7 @@ class UserManager {
/// Get user information
/// [userIDList] List of user IDs
Future<List<UserInfo>> getUsersInfo({
Future<List<FullUserInfo>> 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) => UserInfo.fromJson(v)));
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
/// Get information of the currently logged-in user
Future<UserInfo> getSelfUserInfo({
@ -115,7 +115,7 @@ class UserManager {
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
}
Future<List<UserInfo>> getUsersInfoWithCache(
Future<List<FullUserInfo>> getUsersInfoWithCache(
List<String> userIDs, {
String? groupID,
String? operationID,
@ -128,7 +128,7 @@ class UserManager {
'groupID': groupID,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => UserInfo.fromJson(map)));
.then((value) => Utils.toList(value, (map) => FullUserInfo.fromJson(map)));
}
static Map _buildParam(Map param) {

@ -98,6 +98,22 @@ class FullUserInfo {
return data;
}
String get userID {
return publicInfo?.userID ?? friendInfo?.userID ?? blackInfo?.userID ?? '';
}
String get nickname {
return publicInfo?.nickname ?? friendInfo?.nickname ?? blackInfo?.nickname ?? '';
}
String get faceURL {
return publicInfo?.faceURL ?? friendInfo?.faceURL ?? blackInfo?.faceURL ?? '';
}
String get showName {
return friendInfo?.nickname ?? nickname;
}
}
class PublicUserInfo {

Loading…
Cancel
Save