mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-26 04:46:48 +02:00
4647310322
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.
58 lines
1.6 KiB
Swift
58 lines
1.6 KiB
Swift
import Foundation
|
|
import UIKit
|
|
import ComponentFlow
|
|
import Display
|
|
|
|
public extension ComponentTransition.Animation.Curve {
|
|
init(_ curve: ContainedViewLayoutTransitionCurve) {
|
|
switch curve {
|
|
case .linear:
|
|
self = .linear
|
|
case .easeInOut:
|
|
self = .easeInOut
|
|
case let .custom(a, b, c, d):
|
|
self = .custom(a, b, c, d)
|
|
case .customSpring:
|
|
self = .spring
|
|
case .spring:
|
|
self = .spring
|
|
}
|
|
}
|
|
|
|
var containedViewLayoutTransitionCurve: ContainedViewLayoutTransitionCurve {
|
|
switch self {
|
|
case .linear:
|
|
return .linear
|
|
case .easeInOut:
|
|
return .easeInOut
|
|
case .spring:
|
|
return .spring
|
|
case let .custom(a, b, c, d):
|
|
return .custom(a, b, c, d)
|
|
case .bounce:
|
|
assertionFailure()
|
|
return .spring
|
|
}
|
|
}
|
|
}
|
|
|
|
public extension ComponentTransition {
|
|
init(_ transition: ContainedViewLayoutTransition) {
|
|
switch transition {
|
|
case .immediate:
|
|
self.init(animation: .none)
|
|
case let .animated(duration, curve):
|
|
self.init(animation: .curve(duration: duration, curve: ComponentTransition.Animation.Curve(curve)))
|
|
}
|
|
}
|
|
|
|
var containedViewLayoutTransition: ContainedViewLayoutTransition {
|
|
switch self.animation {
|
|
case .none:
|
|
return .immediate
|
|
case let .curve(duration, curve):
|
|
return .animated(duration: duration, curve: curve.containedViewLayoutTransitionCurve)
|
|
}
|
|
}
|
|
}
|