sendReplyMessage method

Future<V2TimValueCallback<V2TimMessage>> sendReplyMessage({
  1. required String id,
  2. required String receiver,
  3. required String groupID,
  4. required V2TimMessage replyMessage,
  5. MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL,
  6. bool onlineUserOnly = false,
  7. bool isExcludedFromUnreadCount = false,
  8. bool needReadReceipt = false,
  9. OfflinePushInfo? offlinePushInfo,
  10. String? localCustomData,
})

发送回复消息

此id为你要回复的消息的id。举个例子 我发送文本消息:"欧拉欧拉",你回复消息文本消息 "大木大木",回复的文本消息"大木大木"需要创建,其id即此id

Implementation

Future<V2TimValueCallback<V2TimMessage>> sendReplyMessage(
    {required String id, // 自己创建的ID
    required String receiver,
    required String groupID,
    required V2TimMessage replyMessage, // 被回复的消息
    MessagePriorityEnum? priority = MessagePriorityEnum.V2TIM_PRIORITY_NORMAL,
    bool onlineUserOnly = false,
    bool isExcludedFromUnreadCount = false,
    bool needReadReceipt = false,
    OfflinePushInfo? offlinePushInfo,
    String? localCustomData}) async {
  final hasNickName = replyMessage.nickName != null && replyMessage.nickName != "";
  final cloudCustomData = {
    "messageReply": {"messageID": replyMessage.msgID, "messageAbstract": _getAbstractMessage(replyMessage), "messageSender": hasNickName ? replyMessage.nickName : replyMessage.sender, "messageType": replyMessage.elemType, "version": 1}
  };

  return TencentCloudChatSdkPlatform.instance.sendMessage(
      id: id,
      receiver: receiver,
      groupID: groupID,
      needReadReceipt: needReadReceipt,
      priority: priority!.index,
      onlineUserOnly: onlineUserOnly,
      isExcludedFromUnreadCount: isExcludedFromUnreadCount,
      offlinePushInfo: offlinePushInfo?.toJson(),
      localCustomData: localCustomData,
      cloudCustomData: json.encode(cloudCustomData));
}