Fix metadata in file-deletion operations

This commit is contained in:
Vishnu Mohandas 2021-05-04 02:56:23 +05:30
parent d2ebcb12ca
commit a42ad9548a
2 changed files with 10 additions and 5 deletions

View file

@ -3,5 +3,6 @@ import 'package:photos/events/files_updated_event.dart';
class CollectionUpdatedEvent extends FilesUpdatedEvent {
final int collectionID;
CollectionUpdatedEvent(this.collectionID, updatedFiles) : super(updatedFiles);
CollectionUpdatedEvent(this.collectionID, updatedFiles, {type})
: super(updatedFiles, type: type ?? EventType.added_or_updated);
}

View file

@ -48,6 +48,8 @@ Future<void> deleteFilesFromEverywhere(
}
}
} else {
updatedCollectionIDs.add(file.collectionID);
deletedFiles.add(file);
uploadedFileIDsToBeDeleted.add(file.uploadedFileID);
}
}
@ -65,10 +67,12 @@ Future<void> deleteFilesFromEverywhere(
}
for (final collectionID in updatedCollectionIDs) {
Bus.instance.fire(CollectionUpdatedEvent(
collectionID,
deletedFiles
.where((file) => file.collectionID == collectionID)
.toList()));
collectionID,
deletedFiles
.where((file) => file.collectionID == collectionID)
.toList(),
type: EventType.deleted,
));
}
}
if (deletedFiles.isNotEmpty) {