Files
GLEGram-iOS/submodules/GalleryUI/Sources/SecretMediaPreviewFooterContentNode.swift
T
Leeksov 4647310322 GLEGram 12.5 — Initial public release
Based on Swiftgram 12.5 (Telegram iOS 12.5).
All GLEGram features ported and organized in GLEGram/ folder.

Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass,
Font Replacement, Fake Profile, Chat Export, Plugin System, and more.

See CHANGELOG_12.5.md for full details.
2026-04-06 09:48:12 +03:00

47 lines
1.6 KiB
Swift

import Foundation
import UIKit
import AsyncDisplayKit
import Display
import Postbox
import TelegramCore
import SwiftSignalKit
private let textFont = Font.regular(16.0)
final class SecretMediaPreviewFooterContentNode: GalleryFooterContentNode {
private var currentText: String?
private let textNode: ImmediateTextNode
override init() {
self.textNode = ImmediateTextNode()
self.textNode.isUserInteractionEnabled = false
self.textNode.displaysAsynchronously = false
super.init()
self.addSubnode(self.textNode)
}
func setText(_ text: String) {
if self.currentText != text {
self.currentText = text
self.textNode.attributedText = NSAttributedString(string: text, font: textFont, textColor: .white)
self.requestLayout?(.immediate)
}
}
override func updateLayout(size: CGSize, metrics: LayoutMetrics, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, contentInset: CGFloat, transition: ContainedViewLayoutTransition) -> LayoutInfo {
let width = size.width
let panelHeight: CGFloat = 44.0 + bottomInset
let sideInset: CGFloat = leftInset + 8.0
let textSize = self.textNode.updateLayout(CGSize(width: width - sideInset * 2.0, height: CGFloat.greatestFiniteMagnitude))
transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: floor((width - textSize.width) / 2.0), y: floor((44.0 - textSize.height) / 2.0)), size: textSize))
return LayoutInfo(height: panelHeight, needsShadow: false)
}
}