mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Version 11.5.3
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import SGSimpleSettings
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
@@ -832,6 +833,8 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
var isSticker = false
|
||||
var maxDimensions = layoutConstants.image.maxDimensions
|
||||
var maxHeight = layoutConstants.image.maxDimensions.height
|
||||
// MARK: Swiftgram
|
||||
var imageOriginalMaxDimensions: CGSize?
|
||||
var isStory = false
|
||||
|
||||
let _ = isStory
|
||||
@@ -853,6 +856,19 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
}
|
||||
} else if let image = media as? TelegramMediaImage, let dimensions = largestImageRepresentation(image.representations)?.dimensions {
|
||||
unboundSize = CGSize(width: max(10.0, floor(dimensions.cgSize.width * 0.5)), height: max(10.0, floor(dimensions.cgSize.height * 0.5)))
|
||||
// MARK: Swiftgram
|
||||
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info, SGSimpleSettings.shared.wideChannelPosts {
|
||||
imageOriginalMaxDimensions = maxDimensions
|
||||
switch sizeCalculation {
|
||||
case let .constrained(constrainedSize):
|
||||
maxDimensions.width = constrainedSize.width
|
||||
case .unconstrained:
|
||||
maxDimensions.width = unboundSize.width
|
||||
}
|
||||
if message.text.isEmpty {
|
||||
maxDimensions.width = max(layoutConstants.image.maxDimensions.width, unboundSize.aspectFitted(CGSize(width: maxDimensions.width, height: layoutConstants.image.minDimensions.height)).width)
|
||||
}
|
||||
}
|
||||
} else if let file = media as? TelegramMediaFile, var dimensions = file.dimensions {
|
||||
if let thumbnail = file.previewRepresentations.first {
|
||||
let dimensionsVertical = dimensions.width < dimensions.height
|
||||
@@ -1070,6 +1086,9 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
}
|
||||
|
||||
boundingSize = CGSize(width: boundingWidth, height: filledSize.height).cropped(CGSize(width: CGFloat.greatestFiniteMagnitude, height: maxHeight))
|
||||
if let imageOriginalMaxDimensions = imageOriginalMaxDimensions {
|
||||
boundingSize.height = min(boundingSize.height, nativeSize.aspectFitted(imageOriginalMaxDimensions).height)
|
||||
}
|
||||
boundingSize.height = max(boundingSize.height, layoutConstants.image.minDimensions.height)
|
||||
boundingSize.width = max(boundingSize.width, layoutConstants.image.minDimensions.width)
|
||||
switch contentMode {
|
||||
@@ -2659,6 +2678,7 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
icon = .eye
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if displaySpoiler, let context = self.context {
|
||||
let extendedMediaOverlayNode: ExtendedMediaOverlayNode
|
||||
|
||||
Reference in New Issue
Block a user