Don't alias incompatible photo resources

This commit is contained in:
Ali 2023-03-07 13:49:22 +04:00
parent 28e74dad30
commit c74a2baa7a

View File

@ -26,8 +26,11 @@ func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force:
}
}
if let fromLargestRepresentation = largestImageRepresentation(fromImage.representations), let toLargestRepresentation = largestImageRepresentation(toImage.representations) {
if fromLargestRepresentation.progressiveSizes != toLargestRepresentation.progressiveSizes {
} else {
copyOrMoveResourceData(from: fromLargestRepresentation.resource, to: toLargestRepresentation.resource, mediaBox: postbox.mediaBox)
}
}
} else if let fromFile = from as? TelegramMediaFile, let toFile = to as? TelegramMediaFile {
if let fromPreview = smallestImageRepresentation(fromFile.previewRepresentations), let toPreview = smallestImageRepresentation(toFile.previewRepresentations) {
copyOrMoveResourceData(from: fromPreview.resource, to: toPreview.resource, mediaBox: postbox.mediaBox)