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 EditMessage object as an argument to the parameter in the editTextMessage() method.

EditMessage editMessage = new EditMessage();
editMessage.setMessageId(MESSAGE_ID);
editMessage.setEditedTextContent(EDITED_TEXT_CONTENT);
editMessage.setMentionedUsersIds(MENTION_IDS); // Optional
FlyMessenger.editTextMessage(editMessage, (isSuccess, error, chatMessage) -> {
if (isSuccess) {
//find the index of message object in list using messageId
//then fetch message object from db using `FlyMessenger.getMessageOfId(messageId)` and notify the item in list
}
});
ArgumentTypeDescription
EDIT_MESSAGE_PARAMSEditMessageObject to hold the parameters of the Edit Message
CALLBACKSendMessageCallbackcallback 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 EditMessage object as an argument to the parameter in the editMediaCaption() method.

EditMessage editMessage = new EditMessage();
editMessage.setMessageId(MESSAGE_ID);
editMessage.setEditedTextContent(EDITED_TEXT_CONTENT);
editMessage.setMentionedUsersIds(MENTION_IDS); // Optional
FlyMessenger.editMediaCaption(editMessage, (isSuccess, error, chatMessage) -> {
if (isSuccess) {
//find the index of message object in list using messageId
//then fetch message object from db using `FlyMessenger.getMessageOfId(messageId)` and notify the item in list
}
});
ArgumentTypeDescription
EDIT_MESSAGE_PARAMSEditMessageObject to hold the parameters of the Edit Message
CALLBACKSendMessageCallbackcallback 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.