deleteMessagesForMe static method
This method deletes specified messages for the current user but not for other users in the chat.
It can optionally delete associated media files if isMediaDelete
is set to true.
Parameters:
jid
- The JID (Jabber ID) of the user or group from which messages are to be deleted.
chatType
- The type of chat (e.g., "groupchat" or "chat") to specify which chat's messages to delete.
messageIds
- A list of message IDs to be deleted.
isMediaDelete
- A boolean value indicating whether to delete associated media files.
Returns:
flyCallBack
- A callback function that is called with a FlyResponse object upon completion.
Example usage:
await Mirrorfly.deleteMessagesForMe(
jid: "user123@example.com",
chatType: "groupchat" or "chat",
messageIds: ["messageId1", "messageId2"],
isMediaDelete: true,
flyCallBack: (response) {
if (response.isSuccess) {
print("Messages deleted successfully");
} else {
print("Failed to delete messages: ${response.errorMessage}");
}
},
);
Implementation
static Future<void> deleteMessagesForMe(
{required String jid,
required String chatType,
required List<String> messageIds,
bool? isMediaDelete,
required Function(FlyResponse response) flyCallBack}) {
return FlyChatFlutterPlatform.instance.deleteMessagesForMe(
jid, chatType, messageIds, isMediaDelete, flyCallBack);
}