downloadMergerMessage
功能介绍
获取合并消息的子消息列表
参数详解
参数名称 |
参数类型 |
是否必填 |
描述 |
msgID |
string |
是 |
需要获取的合并消息ID |
返回模板
V2TimValueCallback<V2TimMessage[]>
{
code : number
desc : string
data : V2TimMessage[]
}
返回值详解
名称 |
数值类型 |
描述 |
code |
number |
请求结果错误码 |
desc |
string |
请求结果描述 |
data |
V2TimMessage[] |
获取到的合并消息列表 |
代码示例
import { TencentImSDKPlugin, MessageElemType } from 'react-native-tim-js';
const listener = {
onRecvNewMessage: async (message) => {
if (message.elemType === MessageElemType.V2TIM_ELEM_TYPE_MERGER) {
message.mergerElem?.abstractList;
message.mergerElem?.isLayersOverLimit;
message.mergerElem?.title;
const download = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.downloadMergerMessage(message.msgID!);
if (download.code === 0) {
download.data!;
}
}
},
};
TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.addAdvancedMsgListener(listener);
const createMergerMessageResult = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.createMergerMessage(
[
'msgid1',
'msgid2',
],
'user1与user2的聊天',
['user1:hello', 'user2:你好'],
'当前版本不支持该消息'
);
if (createMergerMessageResult.code == 0) {
TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage({
id: createMergerMessageResult.data!.id!,
receiver: 'receiver',
groupID: 'groupID',
});
}