deleteMessagesForEveryone static method
This method deletes specified messages for all users in a chat, optionally including associated media files.
Upon completion, flyCallBack
is invoked with a FlyResponse object containing the result of the operation.
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.deleteMessagesForEveryone(
jid: "user123@example.com",
chatType: "groupchat",
messageIds: ["messageId1", "messageId2"],
isMediaDelete: true,
flyCallBack: (response) {
if (response.isSuccess) {
print("Messages deleted for everyone successfully");
} else {
print("Failed to delete messages for everyone: ${response.errorMessage}");
}
},
);
Implementation
static Future<void> deleteMessagesForEveryone(
{required String jid,
required String chatType,
required List<String> messageIds,
bool? isMediaDelete,
required Function(FlyResponse response) flyCallBack}) {
return FlyChatFlutterPlatform.instance.deleteMessagesForEveryone(
jid, chatType, messageIds, isMediaDelete, flyCallBack);
}