π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
refactor: streamline event firing in CollectionService methods
AmanRajSinghMourya2775e9c0f556
diff --git a/mobile/apps/locker/lib/services/collections/collections_service.dart b/mobile/apps/locker/lib/services/collections/collections_service.dartindex b04b62905a..075220630a 100644--- a/mobile/apps/locker/lib/services/collections/collections_service.dart+++ b/mobile/apps/locker/lib/services/collections/collections_service.dart@@ -268,9 +268,6 @@ class CollectionService {await _apiClient.trash(requests);await _db.deleteFilesFromCollection(collection, [file]);-- Bus.instance.fire(CollectionsUpdatedEvent('trash_file'));-await sync();await TrashService.instance.syncTrash();} catch (e) {@@ -383,13 +380,8 @@ class CollectionService {await moveFilesFromCurrentCollection(collection, files);}- await _apiClient.trashCollection(- collection,- keepFiles: true,- );-- Bus.instance- .fire(CollectionsUpdatedEvent('collection_trashed_keeping_files'));+ await _apiClient.trashCollection(collection, keepFiles: true);+ await sync();} catch (e) {_logger.severe("Failed to trash collection keeping files: $e");rethrow;@@ -402,10 +394,7 @@ class CollectionService {if (files.isNotEmpty) {for (final file in files) {- // Get all collections this file belongs tofinal fileCollections = await getCollectionsForFile(file);-- // Trash the file from ALL collections it belongs tofor (final fileCollection in fileCollections) {await trashFile(file, fileCollection);}@@ -413,10 +402,6 @@ class CollectionService {}await _apiClient.trashCollection(collection);-- Bus.instance- .fire(CollectionsUpdatedEvent('collection_trashed_with_files'));-await sync();await TrashService.instance.syncTrash();} catch (e) {@@ -463,9 +448,6 @@ class CollectionService {await _apiClient.removeFromCollection(collection.id, ownedByCurrentUser);removalsPerformed = true;if (removalsPerformed) {- Bus.instance.fire(- CollectionsUpdatedEvent('files_moved_from_collection'),- );await sync();}return;@@ -476,9 +458,6 @@ class CollectionService {"Cannot remove files owned by others from collection ${collection.id}",);if (removalsPerformed) {- Bus.instance.fire(- CollectionsUpdatedEvent('files_moved_from_collection'),- );await sync();}return;@@ -486,9 +465,6 @@ class CollectionService {if (ownedByCurrentUser.isEmpty) {if (removalsPerformed) {- Bus.instance.fire(- CollectionsUpdatedEvent('files_moved_from_collection'),- );await sync();}return;@@ -550,12 +526,6 @@ class CollectionService {}}- if (removalsPerformed) {- Bus.instance.fire(- CollectionsUpdatedEvent('files_moved_from_collection'),- );- }-if (movesPerformed || removalsPerformed) {await sync();}diff --git a/mobile/apps/locker/lib/utils/collection_actions.dart b/mobile/apps/locker/lib/utils/collection_actions.dartindex 6b34ad183f..1c08610832 100644--- a/mobile/apps/locker/lib/utils/collection_actions.dart+++ b/mobile/apps/locker/lib/utils/collection_actions.dart@@ -140,6 +140,7 @@ class CollectionActions {await progressDialog.show();bool isFavoriteCollection = false;+ final bool keepFiles = !(dialogChoice?.deleteFromAllCollections ?? false);try {for (final collection in collections) {@@ -150,10 +151,11 @@ class CollectionActions {if (collection.type.canDelete) {await CollectionService.instance.trashCollection(collection,- keepFiles: !(dialogChoice?.deleteFromAllCollections ?? false),+ keepFiles: keepFiles,);}}+await progressDialog.hide();SnackBarUtils.showInfoSnackBar(