Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Enhance collection retrieval to optionally include deleted collections

AmanRajSinghMouryaf528bd4fe97c
diff --git a/mobile/apps/locker/lib/services/collections/collections_service.dart b/mobile/apps/locker/lib/services/collections/collections_service.dart
index f026398561..f067d65d2a 100644
--- a/mobile/apps/locker/lib/services/collections/collections_service.dart
+++ b/mobile/apps/locker/lib/services/collections/collections_service.dart
@@ -144,8 +144,14 @@ class CollectionService {
}
}
- Future<List<Collection>> getCollections() async {
- return _db.getCollections();
+ Future<List<Collection>> getCollections({
+ bool includeDeleted = false,
+ }) async {
+ final collections = await _db.getCollections();
+ if (includeDeleted) {
+ return collections;
+ }
+ return collections.where((collection) => !collection.isDeleted).toList();
}
Future<Collection?> getCollectionByID(int collectionID) async {
diff --git a/mobile/apps/locker/lib/services/trash/trash_service.dart b/mobile/apps/locker/lib/services/trash/trash_service.dart
index f95ded81bb..eeade26eca 100644
--- a/mobile/apps/locker/lib/services/trash/trash_service.dart
+++ b/mobile/apps/locker/lib/services/trash/trash_service.dart
@@ -92,7 +92,9 @@ class TrashService {
},
);
final List<Collection> allCollections =
- await CollectionService.instance.getCollections();
+ await CollectionService.instance.getCollections(
+ includeDeleted: true,
+ );
final Map<int, Collection> collectionMap = {
for (final collection in allCollections) collection.id: collection,
};