fix(llc, ui): message search pagination

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2021-09-06 19:35:04 +05:30
committed by xsahil03x
parent 8585456edd
commit 4ddb0703b3
11 changed files with 127 additions and 29 deletions
@@ -113,8 +113,9 @@ class ChannelQueryDao extends DatabaseAccessor<MoorChatDatabase>
cachedChannels.sort(chainedComparator);
if (paginationParams?.offset != null && cachedChannels.isNotEmpty) {
cachedChannels.removeRange(0, paginationParams!.offset);
final offset = paginationParams?.offset;
if (offset != null && offset > 0 && cachedChannels.isNotEmpty) {
cachedChannels.removeRange(0, offset);
}
if (paginationParams?.limit != null) {
@@ -117,8 +117,9 @@ class MessageDao extends DatabaseAccessor<MoorChatDatabase>
msgList.removeRange(0, greaterThanIndex);
}
}
if (options?.limit != null) {
return msgList.take(options!.limit).toList();
final limit = options?.limit;
if (limit != null && limit > 0) {
return msgList.take(limit).toList();
}
}
return msgList;