Edit a Message

Overview#

Edit message is a feature which allows you to edit the content of your previously sent Text Messages and Captions associated with Media (image or video) in your chat conversation.

Note : User can edit only Sent Messages.

Edit Text Message#

To Edit your text message, you need to pass the EditMessageParams object as an argument to the parameter in the editTextMessage() method.

var editMessageParams = EditMessageParams(messageId: MESSAGE_ID, editedTextContent: EDITED_TEXT_CONTENT);
Mirrorfly.editTextMessage(editMessageParams: editMessageParams, flyCallback: (FlyResponse response) {
if (response.isSuccess) {
ChatMessageModel editMessage = sendMessageModelFromJson(response.data);
}
}
});
ArgumentTypeDescription
EDIT_MESSAGE_PARAMSEditMessageParamsObject to hold the parameters of the Edit Message
flyCallbackFlyResponsecallback to observe the action status
info

When a message is being edited, onMessageEdited event will be triggered. Based on this event, update the message and refresh the UI.

Edit Media Caption Message#

To Edit your media caption message, you need to pass the EditMessageParams object as an argument to the parameter in the editMediaCaption() method.

var editMessageParams = EditMessageParams(messageId: MESSAGE_ID, editedTextContent: EDITED_TEXT_CONTENT);
Mirrorfly.editMediaCaption(editMessageParams: editMessageParams, flyCallback: (FlyResponse response) {
if (response.isSuccess) {
ChatMessageModel editMessage = sendMessageModelFromJson(response.data);
}
}
});
ArgumentTypeDescription
EDIT_MESSAGE_PARAMSEditMessageParamsObject to hold the parameters of the Edit Message
flyCallbackFlyResponsecallback to observe the action status
info

When a message is being edited, onMessageEdited event will be triggered. Based on this event, update the message and refresh the UI.