Files
GLEGram-iOS/submodules/TelegramUI/Components/Calls/CallScreen/Sources/Animation/AnimationManager.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

52 lines
1.3 KiB
Swift

import Foundation
import UIKit
import Display
public final class ManagedAnimations {
private var displayLinkSubscription: SharedDisplayLinkDriver.Link?
private var properties: [AnyAnimatedProperty] = []
public var updated: (() -> Void)?
public init() {
}
public func add(property: AnyAnimatedProperty) {
self.properties.append(property)
property.didStartAnimation = { [weak self] in
guard let self else {
return
}
self.updateNeedAnimations()
}
}
private func updateNeedAnimations() {
if self.displayLinkSubscription == nil {
self.displayLinkSubscription = SharedDisplayLinkDriver.shared.add { [weak self] _ in
guard let self else {
return
}
self.update()
}
}
}
private func update() {
var hasRunningAnimations = false
for property in self.properties {
property.update()
if property.hasRunningAnimation {
hasRunningAnimations = true
}
}
if !hasRunningAnimations {
self.displayLinkSubscription = nil
}
self.updated?()
}
}