deleteRemoteMessagesBefore method

Future<void> deleteRemoteMessagesBefore({
  1. required String conversationId,
  2. required ChatConversationType type,
  3. required int timestamp,
})

Unidirectionally removes historical message by timestamp from the server.

Param conversationId The conversation ID.

Param type The conversation type.

Param timestamp The UNIX timestamp in millisecond. Messages with a timestamp smaller than the specified one will be removed.

Implementation

Future<void> deleteRemoteMessagesBefore(
    {required String conversationId,
    required ChatConversationType type,
    required int timestamp}) async {
  try {
    Map request = {
      "convId": conversationId,
      "type": type.index,
      "timestamp": timestamp,
    };
    Map result = await platform_interface.Client.instance.chatManager.callNativeMethod(
        ChatMethodKeys.removeMessagesFromServerWithTs, request);
    ChatError.hasErrorFromResult(result);
  } catch (e) {
    rethrow;
  }
}