appendMessage
功能介绍
添加多Element消息
- 为一个消息添加额外的消息,一般用于为图片消息添加text消息进行描述等场景。
- 只能在创建message的阶段进行appendMessage操作。
参数详解
参数名称 |
参数类型 |
是否必填 |
描述 |
createMessageBaseId |
String |
是 |
需要添加Element的创建的消息id |
createMessageAppendId |
String |
是 |
添加的创建消息id |
返回值
V2TimValueCallback<V2TimMessage>
{
code : int
desc : String
data : {
cloudCustomData : String
customElem : V2TimCustomElem
elemType : int
faceElem : V2TimFaceElem
faceUrl : String
fileElem : V2TimFileElem
friendRemark : String
groupAtUserList : List<String>
groupID : String
groupTipsElem : V2TimGroupTipsElem
id : String
imageElem : V2TimImageElem
isExcludedFromLastMessage : bool
isExcludedFromUnreadCount : bool
isPeerRead : bool
isRead : bool
isSelf : bool
localCustomData : String
localCustomInt : int
locationElem : V2TimLocationElem
mergerElem : V2TimMergerElem
messageFromWeb : String
msgID : String
nameCard : String
needReadReceipt : bool
nickName : String
offlinePushInfo : V2TimOfflinePushInfo
priority : int
progress : int
random : int
sender : String
seq : String
soundElem : V2TimSoundElem
status : int
textElem : V2TimTextElem
timestamp : int
userID : String
videoElem : V2TimVideoElem
}
}
返回值详解
代码示例
V2TimValueCallback<V2TimMsgCreateInfoResult> createTextMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.createTextMessage(
text: "test",
);
V2TimValueCallback<V2TimMsgCreateInfoResult> createAppendMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.createTextMessage(
text: "append",
);
if (createTextMessageRes.code == 0 && createAppendMessageRes.code == 0) {
String? id = createTextMessageRes.data?.id;
String? appendId = createAppendMessageRes.data?.id;
V2TimValueCallback<V2TimMessage> appendMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.appendMessage(
createMessageBaseId: id!, createMessageAppendId: appendId!);
if (appendMessageRes.code == 0) {
V2TimValueCallback<V2TimMessage> sendMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.sendMessage(id: id, receiver: "userID", groupID: "groupID");
if (sendMessageRes.code == 0) {
}
}
}