deleteAllMsgFromLocal
Function Introduction
Description
Deletes all messages in the local conversation, but the conversation itself remains intact. These messages can still be accessed after uninstalling and reinstalling the app.
Note
Relevant Callback: onConversationChanged
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<dynamic> deleteAllMsgFromLocal({
String? operationID,
})
Input Parameters
None
Return Result
Name | Type | Description |
---|---|---|
None | None | Operation successful if no exception thrown |
Code Example
await OpenIM.iMManager.messageManager.deleteAllMsgFromLocal();
// todo
Function Prototype
- (void)deleteAllMsgFromLocalWithOnSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
None
Return Result
Name | Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Success Return |
onFailure | OIMFailureCallback | Failure Return |
Code Example
[OIMManager.manager deleteAllMsgFromLocalOnSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void deleteAllMsgFromLocal(OnBase<String> base)
Input Parameters
Name | Type | Description | Mandatory |
---|---|---|---|
callBack | OnBase<String> | Callback interface | Yes |
Code Example
OpenIMClient.getInstance().messageManager. deleteAllMsgFromLocal(new OnBase<String>() {
public void onError(int code, String error) {
}
public void onSuccess(String data) {
}
})
Function Prototype
IMSDK.deleteAllMsgFromLocal(operationID?: string): Promise<WsResponse>
Input Parameters
None
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();
// use in mini program
// import { getSDK } from '@openim/client-sdk';
// const IMSDK = getSDK();
IMSDK.deleteAllMsgFromLocal()
.then(({ data }) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
IMSDK.asyncApi('deleteAllMsgFromLocal', operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, for problem locating, keep unique. Recommended to use current time and a random number. |
Return Result
The function is made Promise-based through the
openim-uniapp-polyfill
package. When calling, usethen
andcatch
to 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('deleteAllMsgFromLocal', IMSDK.uuid())
.then(() => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
OpenIMSDKRN.deleteAllMsgFromLocal(operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, for problem locating, keep unique. Recommended to use current time and a random number. |
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.deleteAllMsgFromLocal('operationID')
.then(() => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});