SDKsHarmonyOSEnterprise
Set local conversation unread count
Override the local unread message count for one or more conversations.
Use resetConversationUnread() to calibrate local conversation badge counters. This method does not fabricate server unread records and should not substitute for Mark conversation as read:
Code example
import sdk, { ResetConversationUnreadReq } from '@openimsdk/imsdk';
const request: ResetConversationUnreadReq = {
conversationIDs: [conversationID],
num: 0,
};
await sdk.resetConversationUnread(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationIDs | string[] | Yes | List of conversation IDs to update. |
num | number | Yes | Target unread count value (non-negative integer). |
Return value
Returns a Promise that resolves to void when the local counter is reset.
State changes after the call
The specified num is applied to every conversation in conversationIDs. Resolving the Promise triggers both EventOnConversationChanged and EventOnTotalUnreadMessageCountChanged. Correlate conversation items by conversationID and update the badge totals, as detailed in Retrieve conversation list and Get total unread message count.
Was this page helpful?