Skip to content

armgit / ente

Public Imported from GitHub
0

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

Simplify

Neeraj Gupta8930a0ddbcb8
diff --git a/mobile/lib/db/files_db.dart b/mobile/lib/db/files_db.dart
index 6f5196349c..fe824b13df 100644
--- a/mobile/lib/db/files_db.dart
+++ b/mobile/lib/db/files_db.dart
@@ -1588,25 +1588,6 @@ class FilesDB with SqlDbBase {
return files;
}
- Future<List<String>> getGeneratedIDForFilesOlderThan(
- int cutOffTime,
- int ownerID,
- ) async {
- final db = await instance.sqliteAsyncDB;
- final rows = await db.getAll(
- '''
- SELECT DISTINCT $columnGeneratedID FROM $filesTable
- WHERE $columnCreationTime <= ? AND ($columnOwnerID IS NULL OR $columnOwnerID = ?)
- ''',
- [cutOffTime, ownerID],
- );
- final result = <String>[];
- for (final row in rows) {
- result.add(row[columnGeneratedID].toString());
- }
- return result;
- }
-
// For givenUserID, get List of unique LocalIDs for files which are
// uploaded by the given user and location is missing
Future<List<String>> getLocalIDsForFilesWithoutLocation(int ownerID) async {
diff --git a/mobile/lib/services/collections_service.dart b/mobile/lib/services/collections_service.dart
index 979a05a935..3f00218e32 100644
--- a/mobile/lib/services/collections_service.dart
+++ b/mobile/lib/services/collections_service.dart
@@ -314,8 +314,8 @@ class CollectionsService {
return _coverCache[coverKey];
}
- Future<int> getFileCount(Collection c) async {
- if (_countCache.containsKey(c.id)) {
+ Future<int> getFileCount(Collection c, {bool useCache = true}) async {
+ if (_countCache.containsKey(c.id) && useCache) {
return _countCache[c.id]!;
} else {
final count = await _filesDB.collectionFileCount(c.id);
diff --git a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index d29def8033..28b84194cb 100644
--- a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -760,8 +760,10 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
Future<void> _trashCollection() async {
// Fetch the count by-passing the cache to avoid any stale data
- final int count =
- await FilesDB.instance.collectionFileCount(widget.collection!.id);
+ final int count = await CollectionsService.instance.getFileCount(
+ widget.collection!,
+ useCache: false,
+ );
final bool isEmptyCollection = count == 0;
if (isEmptyCollection) {
final dialog = createProgressDialog(