fetchMessageRemoteOlder method
dynamic
fetchMessageRemoteOlder(
- NIMMessage anchor,
- bool updateCredible
)
Implementation
fetchMessageRemoteOlder(NIMMessage anchor, bool updateCredible) {
_logI(
'fetch remote old anchor time:${anchor.timestamp}, need update:$updateCredible');
ChatMessageRepo.fetchHistoryMessage(
anchor, 0, messageLimit, QueryDirection.QUERY_OLD)
.then((value) {
if (value.isSuccess && value.data != null) {
var result = value.data!.reversed.toList();
if (updateCredible && result.length > 0) {
var lastMsg = result[result.length - 1].nimMessage;
credibleTimestamp = lastMsg.timestamp;
_logI(
'updateCredible content:${lastMsg.content}, time:$credibleTimestamp');
ChatMessageRepo.updateRoamMsgTimestamps(lastMsg);
}
_onListFetchSuccess(result, QueryDirection.QUERY_OLD);
} else {
_onListFetchFailed(value.code, value.errorDetails);
}
});
}