Various improvements

This commit is contained in:
Ilya Laktyushin 2026-03-22 14:04:33 +01:00
parent 91548c5b05
commit 6aa99e3553

View file

@ -1686,13 +1686,18 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
updatedFetchControls = FetchControls(fetch: { manual in
if let strongSelf = self {
let disposableSet = DisposableSet()
if file.isAnimated {
strongSelf.fetchDisposable.set(fetchedMediaResource(mediaBox: context.account.postbox.mediaBox, userLocation: .peer(message.id.peerId), userContentType: MediaResourceUserContentType(file: file), reference: AnyMediaReference.message(message: MessageReference(message), media: file).resourceReference(file.resource), statsCategory: statsCategoryForFileWithAttributes(file.attributes)).startStrict())
disposableSet.add(fetchedMediaResource(mediaBox: context.account.postbox.mediaBox, userLocation: .peer(message.id.peerId), userContentType: MediaResourceUserContentType(file: file), reference: AnyMediaReference.message(message: MessageReference(message), media: file).resourceReference(file.resource), statsCategory: statsCategoryForFileWithAttributes(file.attributes)).startStrict())
} else if NativeVideoContent.isHLSVideo(file: file) {
strongSelf.fetchDisposable.set(nil)
} else {
strongSelf.fetchDisposable.set(messageMediaFileInteractiveFetched(context: context, message: message, file: file, userInitiated: manual, storeToDownloadsPeerId: storeToDownloadsPeerId).startStrict())
disposableSet.add(messageMediaFileInteractiveFetched(context: context, message: message, file: file, userInitiated: manual, storeToDownloadsPeerId: storeToDownloadsPeerId).startStrict())
}
if let image = media as? TelegramMediaImage, let representation = largestRepresentationForPhoto(image) {
disposableSet.add(messageMediaImageInteractiveFetched(context: context, message: message, image: image, resource: representation.resource, range: representationFetchRangeForDisplayAtSize(representation: representation, dimension: nil/*isSecretMedia ? nil : 600*/), userInitiated: manual, storeToDownloadsPeerId: storeToDownloadsPeerId).startStrict())
}
strongSelf.fetchDisposable.set(disposableSet)
}
}, cancel: {
if file.isAnimated {