Skip to content

armgit / ente

Public Imported from GitHub
0

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

Avoid redundant home gallery reloads

Neeraj Guptade9b3d718a09
diff --git a/mobile/apps/photos/lib/db/device_files_db.dart b/mobile/apps/photos/lib/db/device_files_db.dart
index b5fcc8c6a7..579eb4e7de 100644
--- a/mobile/apps/photos/lib/db/device_files_db.dart
+++ b/mobile/apps/photos/lib/db/device_files_db.dart
@@ -239,7 +239,6 @@ extension DeviceFiles on FilesDB {
// delete existing pathIDs which are missing on device
existingPathIds.removeAll(devicePathInfo.map((e) => e.item1.id).toSet());
if (existingPathIds.isNotEmpty) {
- hasUpdated = true;
_logger.info(
'Deleting non-backed up pathIds from local '
'$existingPathIds',
@@ -250,12 +249,14 @@ extension DeviceFiles on FilesDB {
// feature, where we delete files which are backed up. Deleting such
// entries here result in us losing out on the information that
// those folders were marked for automatic backup.
- await db.execute(
+ final deletedRows = await db.execute(
'''
- DELETE FROM device_collections WHERE id = ? AND should_backup = $_sqlBoolFalse;
+ DELETE FROM device_collections WHERE id = ? AND should_backup = $_sqlBoolFalse
+ RETURNING id;
''',
[pathID],
);
+ hasUpdated |= deletedRows.isNotEmpty;
await db.execute(
'''
DELETE FROM device_files WHERE path_id = ?;
diff --git a/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart b/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
index 2ac18fee6a..705bcf4f0e 100644
--- a/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
@@ -6,7 +6,6 @@ import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
import "package:photos/core/user_config.dart";
import 'package:photos/db/files_db.dart';
-import 'package:photos/events/backup_folders_updated_event.dart';
import 'package:photos/events/files_updated_event.dart';
import 'package:photos/events/force_reload_home_gallery_event.dart';
import "package:photos/events/hide_shared_items_from_home_gallery_event.dart";
@@ -130,9 +129,6 @@ class _HomeGalleryWidgetState extends State<HomeGalleryWidget> {
EventType.hide,
},
forceReloadEvents: [
- Bus.instance.on<BackupFoldersUpdatedEvent>().where(
- (_) => !largeBackupSession.isStandbyScreenActive,
- ),
Bus.instance.on<ForceReloadHomeGalleryEvent>().where(
(_) => !largeBackupSession.isStandbyScreenActive,
),