pinConversation
Introduction
Pin a specific conversation to the top of the conversation list.
The default order of conversation is sorts by orderKey
, this parameter is int, and will be increased by the time of sending and receiving messages, setting draft for conversation,etc.
The pinned conversations will be front of the unpinned conversations, while the sequence of those pinned conversations will be sorted by orderKey
.
Pinned conversations will be returned as priority when requesting conversation list with getConversationList.
You can check whether a conversation be pinned by isPinned
in V2TimConversation.
You can also get the changing of conversation and isPinned
, after adding a conversation listener by addConversationListener, from onConversationChanged
method invokes, to update the rendering list on UI.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
conversationID | string | yes | The ID of the conversation needs to operate. |
isPinned | boolean | yes | Is needs to be pinned to top. |
Returned template
V2TimCallback
{
code : number
desc : string
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
Code example
import { TencentImSDKPlugin } from 'react-native-tim-js';
const pinConversationRes = await TencentImSDKPlugin.v2TIMManager
.getConversationManager()
.pinConversation(
'',
true
);
if (pinConversationRes.code === 0) {
}