Fix issues in loading remote folder entries

This commit is contained in:
Vishnu Mohandas 2020-07-20 03:38:18 +05:30
parent 185b2f078b
commit da15cc1290
2 changed files with 7 additions and 4 deletions

View file

@ -115,14 +115,15 @@ class FileDB {
}
Future<List<File>> getAllInFolder(
int folderId, int sinceUpdationTime, int limit) async {
int folderId, int beforeCreationTime, int limit) async {
final db = await instance.database;
final results = await db.query(
table,
where:
'$columnRemoteFolderId = ? AND $columnIsDeleted = 0 AND $columnUpdationTime > ? LIMIT ?',
whereArgs: [folderId, sinceUpdationTime, limit],
'$columnRemoteFolderId = ? AND $columnIsDeleted = 0 AND $columnCreationTime < ?',
whereArgs: [folderId, beforeCreationTime],
orderBy: '$columnCreationTime DESC',
limit: limit,
);
return _convertToFiles(results);
}

View file

@ -23,7 +23,9 @@ class _RemoteFolderPageState extends State<RemoteFolderPage> {
var gallery = Gallery(
asyncLoader: (lastFile, limit) => FileDB.instance.getAllInFolder(
widget.folder.id,
lastFile == null ? 0 : lastFile.updationTime,
lastFile == null
? DateTime.now().microsecondsSinceEpoch
: lastFile.creationTime,
limit),
onRefresh: () => FolderSharingService.instance.syncDiff(widget.folder),
tagPrefix: "remote_folder",