getConversationListByFilter
Introduction
Load the conversation list by filtering.
A locally stored conversation list can have unlimited number of conversations. A conversation list stored in the cloud can have up to 100 conversations.
If the information of a conversation has not been updated for a long time, this conversation can be stored in the cloud for at most 7 days. To adjust the period for storing the conversation, contact us.
Locally stored conversations may not always be consistent with those stored in the cloud. If you do not call the deleteConversation API to delete the local conversations, these conversations will always exist. However, at most 100 conversations can be stored in the cloud. In addition, if the information of a conversation has not been updated for a long time, this conversation can be stored in the cloud for at most 7 days. Therefore, local conversations displayed on different mobile phones may be inconsistent with each other.
Parameter details
Parameter name | Parameter type | Required | Platform | Description |
---|---|---|---|---|
filter | V2TimConversationListFilter | yes | All | The filter to be used for filtering conversations. |
Returned template
V2TimValueCallback<V2TimConversationResult>
{
code : int
desc : String
data : {
conversationList : List<V2TimConversation>
isFinished : bool
nextSeq : String // The sequence number used for the next iteration requesting.
}
}
Return value details
name | type | description |
---|---|---|
code | int | Request result: Error codes. 0 means success. |
desc | String | The description of the error. It will be empty if success. |
data | V2TimConversationResult | The list of conversations. |
Code example
V2TimConversationListFilter filter = V2TimConversationListFilter(
conversationType: 0,
nextSeq: 0,
count: 10,
markType: 0,
groupName: "groupName");
V2TimValueCallback<V2TimConversationResult> getConversationListByFilterRes =
await TencentImSDKPlugin.v2TIMManager
.getConversationManager()
.getConversationListByFilter(filter: filter);
if (getConversationListByFilterRes.code == 0) {
String? nextSeq =getConversationListByFilterRes.data?.nextSeq;
List<V2TimConversation?>? conversationList =getConversationListByFilterRes.data?.conversationList;
if (!isFinished!) {
V2TimConversationListFilter nextFilter = V2TimConversationListFilter(
conversationType: 0,
nextSeq: int.parse(nextSeq!),
count: 10,
markType: 0,
groupName: "groupName");
V2TimValueCallback<V2TimConversationResult> nextConversationListRes =
await TencentImSDKPlugin.v2TIMManager
.getConversationManager()
.getConversationListByFilter(
filter: nextFilter);
}
getConversationListByFilterRes.data?.conversationList?.forEach((element) {
element
?.conversationID;
element?.draftText;
element?.draftTimestamp;
element?.faceUrl;
element?.groupAtInfoList;
element?.groupID;
element?.groupType;
element?.isPinned;
element?.lastMessage;
element?.orderkey;
element?.recvOpt;
element
?.showName;
element?.type;
element?.unreadCount;
element?.userID;
});
}