diff --git a/lib/src/manager/im_friendship_manager.dart b/lib/src/manager/im_friendship_manager.dart index ccc8280..b87e0df 100644 --- a/lib/src/manager/im_friendship_manager.dart +++ b/lib/src/manager/im_friendship_manager.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> getFriendList({String? operationID}) => _channel + Future> 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> getFriendListMap({String? operationID}) => _channel diff --git a/lib/src/manager/im_group_manager.dart b/lib/src/manager/im_group_manager.dart index fdce3b0..84a873c 100644 --- a/lib/src/manager/im_group_manager.dart +++ b/lib/src/manager/im_group_manager.dart @@ -566,8 +566,6 @@ class GroupManager { /// Modify the GroupMemberInfo ex field Future setGroupMemberInfo({ - required String groupID, - required String userID, required GroupMembersInfo groupMembersInfo, String? operationID, }) => diff --git a/lib/src/manager/im_user_manager.dart b/lib/src/manager/im_user_manager.dart index cb2f9da..66dbe3e 100644 --- a/lib/src/manager/im_user_manager.dart +++ b/lib/src/manager/im_user_manager.dart @@ -15,7 +15,7 @@ class UserManager { /// Get user information /// [userIDList] List of user IDs - Future> getUsersInfo({ + Future> getUsersInfo({ required List 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 getSelfUserInfo({ @@ -115,7 +115,7 @@ class UserManager { .then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map))); } - Future> getUsersInfoWithCache( + Future> getUsersInfoWithCache( List 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) { diff --git a/lib/src/models/user_info.dart b/lib/src/models/user_info.dart index 6caa115..428ed60 100644 --- a/lib/src/models/user_info.dart +++ b/lib/src/models/user_info.dart @@ -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 {