Remove from album bug (#1682)

This commit is contained in:
Vishnu Mohandas 2024-01-27 18:47:01 +05:30 committed by GitHub
commit 636ec6ca0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 73 additions and 8 deletions

View file

@ -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;
}
}

View file

@ -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();

View file

@ -31,8 +31,6 @@ class CollectionPage extends StatelessWidget {
final _selectedFiles = SelectedFiles();
final GlobalKey shareButtonKey = GlobalKey();
@override
Widget build(BuildContext context) {
if (hasVerifiedLock == false && c.collection.isHidden()) {