Files
GLEGram-iOS/submodules/InstantPageUI/Sources/InstantPageTileNode.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

48 lines
1.5 KiB
Swift

import Foundation
import UIKit
import AsyncDisplayKit
private final class InstantPageTileNodeParameters: NSObject {
let tile: InstantPageTile
let backgroundColor: UIColor
init(tile: InstantPageTile, backgroundColor: UIColor) {
self.tile = tile
self.backgroundColor = backgroundColor
super.init()
}
}
public final class InstantPageTileNode: ASDisplayNode {
private let tile: InstantPageTile
public init(tile: InstantPageTile, backgroundColor: UIColor) {
self.tile = tile
super.init()
self.isLayerBacked = true
self.isOpaque = false
self.backgroundColor = backgroundColor
}
public override func drawParameters(forAsyncLayer layer: _ASDisplayLayer) -> NSObjectProtocol? {
return InstantPageTileNodeParameters(tile: self.tile, backgroundColor: self.backgroundColor ?? UIColor.white)
}
@objc override public class func draw(_ bounds: CGRect, withParameters parameters: Any?, isCancelled: () -> Bool, isRasterizing: Bool) {
let context = UIGraphicsGetCurrentContext()!
if let parameters = parameters as? InstantPageTileNodeParameters {
if !isRasterizing {
context.setBlendMode(.copy)
context.setFillColor(parameters.backgroundColor.cgColor)
context.fill(bounds)
}
parameters.tile.draw(context: context)
}
}
}