getHistoryMessageList method

  1. @override
Future<V2TimValueCallback<List<V2TimMessage>>> getHistoryMessageList({
  1. int getType = HistoryMessageGetType.V2TIM_GET_LOCAL_OLDER_MSG,
  2. String? userID,
  3. String? groupID,
  4. int lastMsgSeq = -1,
  5. required int count,
  6. String? lastMsgID,
  7. List<int>? messageTypeList,
  8. List<int>? messageSeqList,
  9. int? timeBegin,
  10. int? timePeriod,
})
override

获取历史消息高级接口

参数 option 拉取消息选项设置,可以设置从云端、本地拉取更老或更新的消息

请注意: 如果设置为拉取云端消息,当 SDK 检测到没有网络,默认会直接返回本地数据 只有会议群(Meeting)才能拉取到进群前的历史消息,直播群(AVChatRoom)消息不存漫游和本地数据库,调用这个接口无效

web 端使用该接口,消息都是从远端拉取,不支持lastMsgSeq

Implementation

@override
Future<V2TimValueCallback<List<V2TimMessage>>> getHistoryMessageList({
  int getType = HistoryMessageGetType.V2TIM_GET_LOCAL_OLDER_MSG,
  String? userID,
  String? groupID,
  int lastMsgSeq = -1,
  required int count,
  String? lastMsgID,
  List<int>? messageTypeList,
  List<int>? messageSeqList,
  int? timeBegin,
  int? timePeriod,
}) async {
  return V2TimValueCallback<List<V2TimMessage>>.fromJson(
    formatJson(
      await _channel.invokeMethod(
        "getHistoryMessageList",
        buildMessageMangerParam(
          {
            "getType": getType,
            "userID": userID,
            "groupID": groupID,
            'lastMsgSeq': lastMsgSeq,
            "count": count,
            "lastMsgID": lastMsgID,
            "messageTypeList": messageTypeList,
            "messageSeqList": messageSeqList,
            "timeBegin": timeBegin,
            "timePeriod": timePeriod,
          },
        ),
      ),
    ),
  );
}