This commit is contained in:
hrxiang
2022-06-27 17:55:18 +08:00
parent 7247f6b982
commit 6ad47216fb
37 changed files with 970 additions and 256 deletions

View File

@@ -7,16 +7,14 @@ class FriendshipManager {
FriendshipManager(this._channel);
/// Set up a friend relationship listener
/// 好友关系监听
Future setFriendshipListener(OnFriendshipListener listener) {
this.listener = listener;
return _channel.invokeMethod('setFriendListener', _buildParam({}));
}
/// Get friend info by user id
/// 查询好友信息
/// [uidList] 好友的userID集合
/// [uidList] userID集合
Future<List<UserInfo>> getFriendsInfo({
required List<String> uidList,
String? operationID,
@@ -30,10 +28,9 @@ class FriendshipManager {
}))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// Send an friend application
/// 发送一个好友请求,需要对方调用同意申请才能成为好友。
/// [uid] 被邀请的用户ID
/// [reason] 说明
/// [reason] 备注说明
Future<dynamic> addFriend({
required String uid,
String? reason,
@@ -47,7 +44,6 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// Get someone's request to add me as a friend
/// 获取别人加我为好友的申请
Future<List<FriendApplicationInfo>> getRecvFriendApplicationList(
{String? operationID}) =>
@@ -60,7 +56,6 @@ class FriendshipManager {
.then((value) =>
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// Get friend requests from me
/// 获取我发出的好友申请
Future<List<FriendApplicationInfo>> getSendFriendApplicationList(
{String? operationID}) =>
@@ -73,8 +68,7 @@ class FriendshipManager {
.then((value) =>
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// Find all friends including those who have been added to the blacklist
/// 获取好友列表包含已拉入黑名单的好友
/// 获取好友列表,返回的列表包含了已拉入黑名单的好友
Future<List<UserInfo>> getFriendList({String? operationID}) => _channel
.invokeMethod(
'getFriendList',
@@ -83,8 +77,7 @@ class FriendshipManager {
}))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// Find all friends including those who have been added to the blacklist
/// 获取好友列表
/// 获取好友列表,返回的列表包含了已拉入黑名单的好友
Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel
.invokeMethod(
'getFriendList',
@@ -93,7 +86,6 @@ class FriendshipManager {
}))
.then((value) => Utils.toListMap(value));
/// Modify friend remark name
/// 设置好友备注
/// [uid] 好友的userID
/// [remark] 好友的备注
@@ -110,9 +102,8 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// Add friends to blacklist
/// 加入黑名单
/// [uid]被加入黑名单的好友ID
/// [uid] 被加入黑名单的好友ID
Future<dynamic> addBlacklist({
required String uid,
String? operationID,
@@ -124,7 +115,6 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// Find all blacklist
/// 获取黑名单列表
Future<List<UserInfo>> getBlacklist({String? operationID}) => _channel
.invokeMethod(
@@ -134,8 +124,8 @@ class FriendshipManager {
}))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// Remove from blacklist
/// 从黑名单移除
/// [uid] 用户ID
Future<dynamic> removeBlacklist({
required String uid,
String? operationID,
@@ -147,8 +137,8 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// Determine if there is a friendship by userId
/// 检查友好关系
/// [uidList] userID列表
Future<List<FriendshipInfo>> checkFriend({
required List<String> uidList,
String? operationID,
@@ -163,8 +153,8 @@ class FriendshipManager {
.then((value) =>
Utils.toList(value, (v) => FriendshipInfo.fromJson(v)));
/// Dissolve friendship from friend list
/// 删除好友
/// [uid] 用户ID
Future<dynamic> deleteFriend({
required String uid,
String? operationID,
@@ -176,8 +166,9 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// Accept application of be friend
/// 接受好友请求
/// [uid] 用户ID
/// [handleMsg]备注说明
Future<dynamic> acceptFriendApplication({
required String uid,
String? handleMsg,
@@ -191,8 +182,9 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// Refuse application of be friend
/// 拒绝好友请求
/// [uid] 用户ID
/// [handleMsg]备注说明
Future<dynamic> refuseFriendApplication({
required String uid,
String? handleMsg,
@@ -206,7 +198,6 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID),
}));
/// Search friends
/// 查好友
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空
/// [isSearchUserID] 是否以关键词搜索好友ID(注不可以同时为false)为空默认false