deleteMessageFromLocalStorage
Feature Introduction
Note
Delete a message from local storage. After uninstalling the APP, it can be retrieved again.
Attention
Relevant Callback: onConversationChanged If the message being deleted is the latest one, the latest message in the conversation will change.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future deleteMessageFromLocalStorage({
required String conversationID,
required String clientMsgID,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | String | Yes | Conversation ID |
clientMsgID | String | Yes | Message ID |
Return Result
Name | Type | Description |
---|---|---|
~ | ~ | If no exception is thrown, operation is successful |
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 | Mandatory | Description |
---|---|---|---|
conversationID | NSString | Yes | Conversation ID |
clientMsgID | NSString | Yes | Message ID |
Return Result
Name | Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Successful return |
onFailure | OIMFailureCallback | Failed 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 | Mandatory | 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 | Mandatory | Description |
---|---|---|---|
conversationID | string | Yes | Conversation ID |
clientMsgID | string | Yes | Message ID |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse> | Successful callback |
Promise.catch() | Promise<WsResponse> | Failed 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();
// use in mini program
// import { OpenIMSDK } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();
IMSDK.deleteMessageFromLocalStorage({
conversationID: '',
clientMsgID: '',
})
.then(({ data }) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
IMSDK.asyncApi('deleteMessageFromLocalStorage', operationID: string, {
conversationID: string;
clientMsgID: string;
}): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID used to identify issues, recommended to use current time and a random number |
conversationID | string | Yes | Conversation ID |
clientMsgID | string | Yes | Message ID |
Return Result
Through the
openim-uniapp-polyfill
package, the function is Promise-based. When calling, usethen
andcatch
to determine and handle successful and failed callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Successful callback |
Promise.catch() | Promise<CatchResponse> | Failed callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('deleteMessageFromLocalStorage', IMSDK.uuid(), {
conversationID: '',
clientMsgID: '',
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.deleteMessageFromLocalStorage({
conversationID: string,
clientMsgID:string
}, operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID used to identify issues, recommended to use current time and a random number |
conversationID | string | Yes | Conversation ID |
clientMsgID | string | Yes | Message ID |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.deleteMessageFromLocalStorage({
conversationID: '',
clientMsgID: '',
}, 'operationID')
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static void DeleteMessageFromLocalStorage(OnBase<bool> cb, string conversationId, string clientMsgId)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase | Yes | Callback |
conversationId | string | Yes | Conversation ID |
clientMsgId | string | Yes | Message ID |
Code Example
IMSDK.DeleteMessageFromLocalStorage((suc,errCode,errMsg)=>{
},conversationId,clientMsgId);