From f72d971f48ff1a9a79425663b56d5022d19a5646 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 15 Jul 2020 19:25:41 +0400 Subject: [PATCH] Use largest image size in chat list --- submodules/PhotoResources/Sources/PhotoResources.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/submodules/PhotoResources/Sources/PhotoResources.swift b/submodules/PhotoResources/Sources/PhotoResources.swift index a2f8bff4c7..779ea83794 100644 --- a/submodules/PhotoResources/Sources/PhotoResources.swift +++ b/submodules/PhotoResources/Sources/PhotoResources.swift @@ -1157,7 +1157,11 @@ public func avatarGalleryThumbnailPhoto(account: Account, representations: [Imag public func mediaGridMessagePhoto(account: Account, photoReference: ImageMediaReference, fullRepresentationSize: CGSize = CGSize(width: 127.0, height: 127.0), synchronousLoad: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { let useMiniThumbnailIfAvailable: Bool = fullRepresentationSize.width < 40.0 - let signal = chatMessagePhotoDatas(postbox: account.postbox, photoReference: photoReference, fullRepresentationSize: fullRepresentationSize, autoFetchFullSize: true, tryAdditionalRepresentations: useMiniThumbnailIfAvailable, synchronousLoad: synchronousLoad, useMiniThumbnailIfAvailable: useMiniThumbnailIfAvailable) + var updatedFullRepresentationSize = fullRepresentationSize + if useMiniThumbnailIfAvailable, let largest = largestImageRepresentation(photoReference.media.representations) { + updatedFullRepresentationSize = largest.dimensions.cgSize + } + let signal = chatMessagePhotoDatas(postbox: account.postbox, photoReference: photoReference, fullRepresentationSize: updatedFullRepresentationSize, autoFetchFullSize: true, tryAdditionalRepresentations: useMiniThumbnailIfAvailable, synchronousLoad: synchronousLoad, useMiniThumbnailIfAvailable: useMiniThumbnailIfAvailable) return signal |> map { value in