Merge and Forward | Display of Merged Message | Click Merged Message to Download Message List for Display |
| | |
createMergerMessage
API (Details) to create a merged message. The list of original messages as well as the merged message title and digest also need to be set.Attribute | Description | Remarks |
msgIDList | List of IDs of original messages | List of IDs of original messages to be merged and forwarded |
title | Title | Title of the merged message, such as "Chat History of xixiyah and Hello" as shown above |
abstractList | Digest list | Digest list of the merged message as shown above. The original message digests need to be displayed for the merged message, which will be unfolded after the user clicks the cell. |
compatibleText | Compatibility text message | If the early SDK version does not support the merged message, the user will receive a text message with the content compatibleText by default. |
// List of messages to be forwarded, which can contain merged messages but not group tipsV2TimValueCallback<V2TimMsgCreateInfoResult> createMergerMessageResult =await TencentImSDKPlugin.v2TIMManager.getMessageManager().createMergerMessage(msgIDList: ["msgid1", "msgid2"],title: "Chat History of user1 and user2", // Title of the merged messageabstractList: ["user1:hello", "user2:hello"], // Digest list of the merged messagecompatibleText: "The current version does not support the message", // Compatibility text of the merged message. If the early SDK version does not support the merged message, the user will receive a text message with the content `compatibleText` by default.);if (createMergerMessageResult.code == 0) {TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage(id: createMergerMessageResult.data.id,receiver: "",groupID: "",);}
addAdvancedMsgListener
(Details) to add the advanced message listener.
We recommend it be called early, such as after the chat page is initialized, to ensure timely message receiving in the application.TencentImSDKPlugin.v2TIMManager.getMessageManager().addAdvancedMsgListener(listener: listener);
V2TimMessage
in onRecvNewMessage
.
You can use the merged message element V2TimMergerElem
(Details) to get the title
and abstractList
for UI display.
Then, when the user clicks the merged message, you can call the downloadMergerMessage
API (Details) to download the merged message list for UI display.if(message.elemType == MessageElemType.V2TIM_ELEM_TYPE_MERGER){message.mergerElem.abstractList;message.mergerElem.isLayersOverLimit;message.mergerElem.title;V2TimValueCallback<List<V2TimMessage>> download = await TencentImSDKPlugin.v2TIMManager.getMessageManager().downloadMergerMessage(msgID: message.msgID,);if(download.code == 0){List<V2TimMessage> messageList = download.data;}}
createForwardMessage
API (Details) first, and then call the sendMessage
API (Details) to send the message.// Create a message with the same elements as the original messageV2TimValueCallback<V2TimMsgCreateInfoResult> createForwardMessageRes = await TencentImSDKPlugin.v2TIMManager.getMessageManager().createForwardMessage(msgID: "msgid");// Send the message to the user `denny`if(createForwardMessageRes.code == 0){TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage(id: createForwardMessageRes.data.id, receiver: "denny", groupID: "");}
Was this page helpful?