deleteMessageFromLocalStorage
Introduction
Delete the message from local storage.
This API can only be used to delete a local historical message. After deleted, the message will be marked as deleted locally by the SDK and can no longer be pulled through getHistoryMessageList.
If the application is uninstalled and reinstalled, the delete marker will be lost locally, and the message can still be pulled through getHistoryMessageList.
The lastMessage
from V2TimConversation
will ba changed to the previous message, if the deleted message is the last message.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
msgID | string | yes | The msgID of the message to be deleted. |
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 deleteMessageFromLocalStorageRes = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.deleteMessageFromLocalStorage('');
if (deleteMessageFromLocalStorageRes.code === 0) {
}