deleteMessagesForMe method

  1. @override
Future<void> deleteMessagesForMe(
  1. String jid,
  2. String chatType,
  3. List<String> messageIds,
  4. bool? isMediaDelete,
  5. dynamic callback(
    1. FlyResponse response
    )?,
)
override

This method is used to delete the messages locally for the user.

Implementation

@override
Future<void> deleteMessagesForMe(
    String jid,
    String chatType,
    List<String> messageIds,
    bool? isMediaDelete,
    Function(FlyResponse response)? callback) async {
  bool? messageDeleteResponse;
  try {
    messageDeleteResponse = await mirrorFlyMethodChannel
        .invokeMethod<bool>('deleteMessagesForMe', {
      "jid": jid,
      "chat_type": chatType,
      "isMediaDelete": isMediaDelete,
      "message_ids": messageIds
    });
    LogMessage.d("deleteMessagesForMe Response ", " $messageDeleteResponse");
    callback?.call(FlyResponse(true, FlyConstants.empty, FlyConstants.empty));
    // return messageDeleteResponse ?? false;
  } on PlatformException catch (e) {
    LogMessage.d("Platform Exception =", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(e.code, e.message, e.details)));
  } on Exception catch (e) {
    LogMessage.d("Exception ", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
  }
}