deleteMessageFromLocalStorage
Description
info
Delete a message from local storage. It can still be retrieved after reinstalling the APP.
Note
Related Callback:
onConversationChanged
If the deleted message is the latest message, the latest message of the conversation will change
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron
- React-Native
- Unity
Function Prototype
Future deleteMessageFromLocalStorage({
required String conversationID,
required String clientMsgID,
String? operationID,
})
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| conversationID | String | Yes | Conversation ID |
| clientMsgID | String | Yes | Message ID |
Return Result
| Name | Type | Description |
|---|---|---|
| ~ | ~ | Operation is successful if no exception is thrown |
Code Example
await OpenIM.iMManager.messageManager.deleteMessageFromLocalStorage(
"conversationID":"conversationID",
"clientMsgID":"clientMsgID",
);
// todo
Function Prototype
- (void)deleteMessageFromLocalStorage:(NSString *)conversationID
clientMsgID:(NSString *)clientMsgID
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure;
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| conversationID | NSString | Yes | Conversation ID |
| clientMsgID | NSString | Yes | Message ID |
Return Result
| Name | Type | Description |
|---|---|---|
| onSuccess | OIMSuccessCallback | Success return |
| onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager deleteMessageFromLocalStorage:
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void deleteMessageFromLocalStorage(String conversationID, String clientMsgID, OnBase<String> callBack)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| conversationID | String | Yes | Conversation ID |
| clientMsgID | String | Yes | Message ID |
| callBack | OnBase<String> | Yes | Callback interface |
Code Example
OpenIMClient.getInstance().messageManager. deleteMessageFromLocalStorage(conversationID, clientMsgID,new OnBase<String>() {
public void onError(int code, String error) {
}
public void onSuccess(String data) {
}
})
// todo
Function Prototype
IMSDK.deleteMessageFromLocalStorage({
conversationID: string;
clientMsgID: string;
}, operationID?: string): Promise<WsResponse>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| conversationID | string | Yes | Conversation ID |
| clientMsgID | string | Yes | Message ID |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<WsResponse> | Success callback |
| Promise.catch() | Promise<WsResponse> | Failure callback |
Code Example
import { getSDK } from '@openim/wasm-client-sdk';
const IMSDK = getSDK();
// use in electron with ffi
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
// const { instance: IMSDK } = getWithRenderProcess();
IMSDK.deleteMessageFromLocalStorage({
conversationID: '',
clientMsgID: '',
})
.then(({ data }) => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
IMSDK.asyncApi('deleteMessageFromLocalStorage', operationID: string, {
conversationID: string;
clientMsgID: string;
}): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| operationID | string | Yes | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
| conversationID | string | Yes | Conversation ID |
| clientMsgID | string | Yes | Message ID |
Return Result
Use the
openim-uniapp-polyfillpackage to make the function Promise. When calling, you need to usethenandcatchto determine and handle success and failure callbacks.
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<void> | Success callback |
| Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('deleteMessageFromLocalStorage', IMSDK.uuid(), {
conversationID: '',
clientMsgID: '',
})
.then(() => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDK.deleteMessageFromLocalStorage({
conversationID: string,
clientMsgID:string
}, operationID?: string): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
| conversationID | string | Yes | Conversation ID |
| clientMsgID | string | Yes | Message ID |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<void> | Success callback |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import OpenIMSDK from "@openim/rn-client-sdk";
OpenIMSDK.deleteMessageFromLocalStorage({
conversationID: '',
clientMsgID: '',
})
.then(() => {
// Call successful
})
.catch((error) => {
// Call failed
});
Function Prototype
public static void DeleteMessageFromLocalStorage(OnBase<bool> cb, string conversationId, string clientMsgId)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| cb | onBase | Yes | Callback interface |
| conversationId | string | Yes | Conversation ID |
| clientMsgId | string | Yes | Message ID |
Code Example
IMSDK.DeleteMessageFromLocalStorage((suc,errCode,errMsg)=>{
},conversationId,clientMsgId);