mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various improvements
This commit is contained in:
@@ -74,12 +74,36 @@ public final class MoreButtonNode: ASDisplayNode {
|
||||
private let buttonNode: HighlightableButtonNode
|
||||
public let iconNode: MoreIconNode
|
||||
|
||||
private var color: UIColor?
|
||||
|
||||
public var theme: PresentationTheme {
|
||||
didSet {
|
||||
self.iconNode.customColor = self.theme.rootController.navigationBar.buttonColor
|
||||
self.update()
|
||||
}
|
||||
}
|
||||
|
||||
public func updateColor(_ color: UIColor?, transition: ContainedViewLayoutTransition) {
|
||||
self.color = color
|
||||
|
||||
if case let .animated(duration, curve) = transition {
|
||||
if let snapshotView = self.iconNode.view.snapshotContentTree() {
|
||||
snapshotView.frame = self.iconNode.frame
|
||||
self.view.addSubview(snapshotView)
|
||||
|
||||
snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: duration, timingFunction: curve.timingFunction, removeOnCompletion: false, completion: { _ in
|
||||
snapshotView.removeFromSuperview()
|
||||
})
|
||||
self.iconNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: duration, timingFunction: curve.timingFunction)
|
||||
}
|
||||
}
|
||||
self.update()
|
||||
}
|
||||
|
||||
private func update() {
|
||||
let color = self.color ?? self.theme.rootController.navigationBar.buttonColor
|
||||
self.iconNode.customColor = color
|
||||
}
|
||||
|
||||
public init(theme: PresentationTheme) {
|
||||
self.theme = theme
|
||||
|
||||
|
||||
Reference in New Issue
Block a user