getRemoteChatRoomHistoryMessages static method
Future<void>
getRemoteChatRoomHistoryMessages(
- String targetId,
- int recordTime,
- int count,
- int order,
- dynamic finished(
- List? msgList,
- int? syncTime,
- int? code
)?,
)
Implementation
static Future<void> getRemoteChatRoomHistoryMessages(String targetId, int recordTime, int count, int /*RCTimestampOrder*/ order, Function(List? /*<Message>*/ msgList, int? syncTime, int? code)? finished) async {
Map map = {
"targetId": targetId,
"recordTime": recordTime,
"count": count,
"order": order,
};
Map resultMap = await _channel.invokeMethod(RCMethodKey.GetRemoteChatRoomHistoryMessages, map);
int? code = resultMap["code"];
int? syncTime = resultMap["syncTime"];
if (code == 0) {
List? msgStrList = resultMap["messages"];
if (msgStrList == null) {
if (finished != null) {
finished(null, syncTime, code);
}
return;
}
List list = [];
for (String msgStr in msgStrList) {
Message? m = MessageFactory.instance!.string2Message(msgStr);
list.add(m);
}
if (finished != null) {
finished(list, syncTime, code);
}
} else {
if (finished != null) {
finished(null, syncTime, code);
}
}
}