diff --git a/lib/db/files_db.dart b/lib/db/files_db.dart index 452dfca46..528d01581 100644 --- a/lib/db/files_db.dart +++ b/lib/db/files_db.dart @@ -120,19 +120,11 @@ class FilesDB { return _convertToFiles(results)[0]; } - Future> getOwnedFiles(int ownerID) async { + Future> getFiles() async { final db = await instance.database; - final whereArgs = List(); - if (ownerID != null) { - whereArgs.add(ownerID); - } final results = await db.query( table, - where: '$columnIsDeleted = 0' + - (ownerID == null - ? '' - : ' AND ($columnOwnerID IS NULL OR $columnOwnerID = ?)'), - whereArgs: whereArgs, + where: '$columnIsDeleted = 0', orderBy: '$columnCreationTime DESC', ); return _convertToFiles(results); diff --git a/lib/repositories/file_repository.dart b/lib/repositories/file_repository.dart index 1293a7f7d..3d104c252 100644 --- a/lib/repositories/file_repository.dart +++ b/lib/repositories/file_repository.dart @@ -1,5 +1,4 @@ import 'package:logging/logging.dart'; -import 'package:photos/core/configuration.dart'; import 'package:photos/core/event_bus.dart'; import 'package:photos/db/files_db.dart'; import 'package:photos/events/local_photos_updated_event.dart'; @@ -17,9 +16,7 @@ class FileRepository { } Future> loadFiles() async { - var files = await FilesDB.instance - .getOwnedFiles(Configuration.instance.getUserID()); - + var files = await FilesDB.instance.getFiles(); _files.clear(); _files.addAll(files);