Load more messages

This commit is contained in:
2024-06-23 18:03:46 +08:00
parent 52e5dd6860
commit 2038d33a31
3 changed files with 61 additions and 32 deletions

View File

@ -32,13 +32,14 @@ extension MessageHistoryHelper on MessageHistoryDb {
await localMessages.delete(id);
}
syncMessages(Channel channel, {String scope = 'global'}) async {
syncMessages(Channel channel, {String scope = 'global', offset = 0}) async {
final lastOne = await localMessages.findLastByChannel(channel.id);
final data = await _getRemoteMessages(
channel,
scope,
remainBreath: 5,
remainBreath: 3,
offset: offset,
onBrake: (items) {
return items.any((x) => x.id == lastOne?.id);
},