tencent cloud

Flutter
마지막 업데이트 시간:2025-04-16 14:40:39
Flutter
마지막 업데이트 시간: 2025-04-16 14:40:39

Overview

This feature enables any member in a conversation to modify a successfully sent message in the conversation. The message will be synced to all the members in the conversation once modified successfully.
Note:
This feature is supported only by the SDK for Flutter on v4.0.0 or later.

Modifying a Message

A conversation participant can call the modifyMessage API (details) to modify a sent message in the conversation.
The Chat SDK allows any conversation participant to modify a message in the conversation. You can add more restrictions at the business layer, for example, only allowing the message sender to modify the message.
Currently, the following information of a message can be modified:
localCustomData (details)
localCustomInt (details)
cloudCustomData (details)
V2TIMTextElem (details)
V2TIMCustomElem (details)
Sample code:
// Find the message to be modified
V2TimValueCallback<List<V2TimMessage>> msgListRes = await TencentImSDKPlugin.v2TIMManager.getMessageManager().findMessages(messageIDList: ['msgid']);
// Edit the message
if(msgListRes.code == 0){
List<V2TimMessage> messageList = msgListRes.data;
if(messageList.isNotEmpty){
V2TimMessage originMessage = messageList[0];
originMessage.cloudCustomData = "change data";
V2TimValueCallback<V2TimMessageChangeInfo> modify = await TencentImSDKPlugin.v2TIMManager.getMessageManager().modifyMessage(message: originMessage);
if(modify.code == 0){
if(modify.data.code ==0){
// Modified successfully
}
}
}
}

Listening for a Message Modification Callback

Conversation participants call addAdvancedMsgListener (details) to add the advanced message listener.
After a message in the conversation is modified, all the participants will receive the onRecvMessageModified callback (details), which contains the modified message object.
Sample code:
onRecvMessageModified: (V2TimMessage message) {
// `msg` is the modified message object
},

문제 해결에 도움이 되었나요?
더 자세한 내용은 문의하기 또는 티켓 제출 을 통해 문의할 수 있습니다.
아니오

피드백