Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix: Removing a file from album stuck after coming back to album using the back button, after adding the file to a different album

ashilkn56c1f94b4b20
diff --git a/lib/models/file/file.dart b/lib/models/file/file.dart
index 208cfa7901..607988a1b9 100644
--- a/lib/models/file/file.dart
+++ b/lib/models/file/file.dart
@@ -332,4 +332,71 @@ class EnteFile {
// todo: Neeraj: 19thJuly'22: evaluate and add fileHash as the key?
return localID ?? uploadedFileID?.toString() ?? generatedID.toString();
}
+
+ EnteFile copyWith({
+ int? generatedID,
+ int? uploadedFileID,
+ int? ownerID,
+ int? collectionID,
+ String? localID,
+ String? title,
+ String? deviceFolder,
+ int? creationTime,
+ int? modificationTime,
+ int? updationTime,
+ int? addedTime,
+ Location? location,
+ FileType? fileType,
+ int? fileSubType,
+ int? duration,
+ String? exif,
+ String? hash,
+ int? metadataVersion,
+ String? encryptedKey,
+ String? keyDecryptionNonce,
+ String? fileDecryptionHeader,
+ String? thumbnailDecryptionHeader,
+ String? metadataDecryptionHeader,
+ int? fileSize,
+ String? mMdEncodedJson,
+ int? mMdVersion,
+ MagicMetadata? magicMetadata,
+ String? pubMmdEncodedJson,
+ int? pubMmdVersion,
+ PubMagicMetadata? pubMagicMetadata,
+ }) {
+ return EnteFile()
+ ..generatedID = generatedID ?? this.generatedID
+ ..uploadedFileID = uploadedFileID ?? this.uploadedFileID
+ ..ownerID = ownerID ?? this.ownerID
+ ..collectionID = collectionID ?? this.collectionID
+ ..localID = localID ?? this.localID
+ ..title = title ?? this.title
+ ..deviceFolder = deviceFolder ?? this.deviceFolder
+ ..creationTime = creationTime ?? this.creationTime
+ ..modificationTime = modificationTime ?? this.modificationTime
+ ..updationTime = updationTime ?? this.updationTime
+ ..addedTime = addedTime ?? this.addedTime
+ ..location = location ?? this.location
+ ..fileType = fileType ?? this.fileType
+ ..fileSubType = fileSubType ?? this.fileSubType
+ ..duration = duration ?? this.duration
+ ..exif = exif ?? this.exif
+ ..hash = hash ?? this.hash
+ ..metadataVersion = metadataVersion ?? this.metadataVersion
+ ..encryptedKey = encryptedKey ?? this.encryptedKey
+ ..keyDecryptionNonce = keyDecryptionNonce ?? this.keyDecryptionNonce
+ ..fileDecryptionHeader = fileDecryptionHeader ?? this.fileDecryptionHeader
+ ..thumbnailDecryptionHeader =
+ thumbnailDecryptionHeader ?? this.thumbnailDecryptionHeader
+ ..metadataDecryptionHeader =
+ metadataDecryptionHeader ?? this.metadataDecryptionHeader
+ ..fileSize = fileSize ?? this.fileSize
+ ..mMdEncodedJson = mMdEncodedJson ?? this.mMdEncodedJson
+ ..mMdVersion = mMdVersion ?? this.mMdVersion
+ ..magicMetadata = magicMetadata ?? this.magicMetadata
+ ..pubMmdEncodedJson = pubMmdEncodedJson ?? this.pubMmdEncodedJson
+ ..pubMmdVersion = pubMmdVersion ?? this.pubMmdVersion
+ ..pubMagicMetadata = pubMagicMetadata ?? this.pubMagicMetadata;
+ }
}
diff --git a/lib/ui/actions/collection/collection_file_actions.dart b/lib/ui/actions/collection/collection_file_actions.dart
index de748dd76d..8315c235b0 100644
--- a/lib/ui/actions/collection/collection_file_actions.dart
+++ b/lib/ui/actions/collection/collection_file_actions.dart
@@ -122,7 +122,7 @@ extension CollectionFileActions on CollectionActions {
for (final file in selectedFiles!) {
EnteFile? currentFile;
if (file.uploadedFileID != null) {
- currentFile = file;
+ currentFile = file.copyWith();
} else if (file.generatedID != null) {
// when file is not uploaded, refresh the state from the db to
// ensure we have latest upload status for given file before
@@ -216,11 +216,11 @@ extension CollectionFileActions on CollectionActions {
return true;
} catch (e, s) {
logger.severe(e, s);
- showShortToast(
- context,
- markAsFavorite
- ? S.of(context).sorryCouldNotAddToFavorites
- : S.of(context).sorryCouldNotRemoveFromFavorites,
+ showShortToast(
+ context,
+ markAsFavorite
+ ? S.of(context).sorryCouldNotAddToFavorites
+ : S.of(context).sorryCouldNotRemoveFromFavorites,
);
} finally {
await dialog.hide();