mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-06-11 20:37:47 +02:00
Update Ghostgram features
This commit is contained in:
+25
@@ -1,3 +1,4 @@
|
||||
import SGSimpleSettings
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
@@ -947,6 +948,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
|
||||
var isGift = false
|
||||
|
||||
@@ -969,6 +972,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
|
||||
@@ -1112,6 +1128,7 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
context: context,
|
||||
presentationData: presentationData,
|
||||
edited: dateAndStatus.edited && !presentationData.isPreview,
|
||||
isDeleted: message.ghostgramIsDeleted,
|
||||
impressionCount: !presentationData.isPreview ? dateAndStatus.viewCount : nil,
|
||||
dateText: dateAndStatus.dateText,
|
||||
type: dateAndStatus.type,
|
||||
@@ -1196,6 +1213,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 {
|
||||
@@ -2992,6 +3012,7 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
icon = .eye
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if displaySpoiler, let context = self.context {
|
||||
let extendedMediaOverlayNode: ExtendedMediaOverlayNode
|
||||
@@ -3272,6 +3293,10 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
}
|
||||
|
||||
public func scrubberTransition() -> GalleryItemScrubberTransition? {
|
||||
if "".isEmpty {
|
||||
return nil
|
||||
}
|
||||
|
||||
final class TimestampContainerTransitionView: UIView {
|
||||
let containerView: UIView
|
||||
let containerMaskView: UIImageView
|
||||
|
||||
Reference in New Issue
Block a user