IM即时通讯

好友关系

添加好友

发起好友申请,请求添加对方为好友。

  • 调用接口:
await CRIM.iMManager.friendshipManager.addFriend(
  userID: otherUserID,
  reqMsg: "添加一个好友呗",
);

相关 API 请参考:

相关回调请参考:

获取收到的好友申请

获取收到的好友申请,可调用同意好友申请或拒绝好友申请处理申请。

  • 调用接口:
final List<FriendApplicationInfo> friendReqs =
    await CRIM.iMManager.friendshipManager.getFriendReqListAsRecipient();

相关 API 请参考:

获取发出的好友申请

获取发出的好友申请状态。

  • 调用接口:
final List<FriendApplicationInfo> friendReqs =
    await CRIM.iMManager.friendshipManager.getFriendReqListAsApplicant();

相关 API 请参考:

同意好友申请

同意对方添加自己为好友,会触发申请方的 friendReqAccepted 回调。

  • 调用接口:
await CRIM.iMManager.friendshipManager.acceptFriendReq(
  userID: otherUserID,
  handleMsg: "ok",
);

相关 API 请参考:

相关回调请参考:

拒绝好友申请

拒绝对方添加自己为好友,会触发申请方的 friendReqRejected 回调。

  • 调用接口:
await CRIM.iMManager.friendshipManager.refuseFriendReq(
  userID: otherUserID,
  handleMsg: "no",
);

相关 API 请参考:

相关回调请参考:

获取好友列表

  • 调用接口:
final List<FriendInfo> friends = await CRIM.iMManager.friendshipManager.getFriendList(
  filterBlack: false,
);

相关 API 请参考:

获取好友信息

调用接口获取好友的头像、昵称信息,可批量获取。

  • 调用接口:
final List<FullUserInfo> userInfos =
    await CRIM.iMManager.friendshipManager.getFriendsInfo(
  userIDs: [otherUserID],
);

相关 API 请参考:

检查是否好友关系

检验好友关系,判断是否在自己的好友列表中。

  • 调用接口:
final List<FriendshipInfo> results =
    await CRIM.iMManager.friendshipManager.checkFriend(
  userIDs: [otherUserID],
);

相关 API 请参考:

设置好友备注

  • 调用接口:
await CRIM.iMManager.friendshipManager.setFriendRemark(
  userID: otherUserID,
  remark: "xxx",
);

相关 API 请参考:

相关回调请参考:

删除好友

删除好友。好友关系是相互的,删除时将导致双方都互不为好友;删除好友并不会自动删除会话,如要删除会话,可以再调用删除会话的函数。

  • 调用接口:
await CRIM.iMManager.friendshipManager.deleteFriend(
  userID: otherUserID,
);

相关 API 请参考:

相关回调请参考:

搜索本地好友

在自己的好友列表中通过关键词搜索。至少需指定一个搜索域;多个域之间是或的关系。

  • 调用接口:
final List<SearchFriendsInfo> result =
    await CRIM.iMManager.friendshipManager.searchFriends(
  keywordList: ["xxx"],
  isSearchRemark: true,
  isSearchUserID: true,
  isSearchNickname: false,
);

相关 API 请参考: