mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-08 17:53:38 +00:00
Fix navigation buttons disabled state
This commit is contained in:
parent
1ad432fd9c
commit
4fd8b81a77
@ -50,6 +50,8 @@ public class ImmediateTextNode: TextNode {
|
|||||||
|
|
||||||
public var trailingLineWidth: CGFloat?
|
public var trailingLineWidth: CGFloat?
|
||||||
|
|
||||||
|
var constrainedSize: CGSize?
|
||||||
|
|
||||||
public var highlightAttributeAction: (([NSAttributedString.Key: Any]) -> NSAttributedString.Key?)? {
|
public var highlightAttributeAction: (([NSAttributedString.Key: Any]) -> NSAttributedString.Key?)? {
|
||||||
didSet {
|
didSet {
|
||||||
if self.isNodeLoaded {
|
if self.isNodeLoaded {
|
||||||
@ -83,6 +85,8 @@ public class ImmediateTextNode: TextNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func updateLayout(_ constrainedSize: CGSize) -> CGSize {
|
public func updateLayout(_ constrainedSize: CGSize) -> CGSize {
|
||||||
|
self.constrainedSize = constrainedSize
|
||||||
|
|
||||||
let makeLayout = TextNode.asyncLayout(self)
|
let makeLayout = TextNode.asyncLayout(self)
|
||||||
let (layout, apply) = makeLayout(TextNodeLayoutArguments(attributedString: self.attributedText, backgroundColor: nil, maximumNumberOfLines: self.maximumNumberOfLines, truncationType: self.truncationType, constrainedSize: constrainedSize, alignment: self.textAlignment, lineSpacing: self.lineSpacing, cutout: self.cutout, insets: self.insets, textShadowColor: self.textShadowColor, textStroke: self.textStroke))
|
let (layout, apply) = makeLayout(TextNodeLayoutArguments(attributedString: self.attributedText, backgroundColor: nil, maximumNumberOfLines: self.maximumNumberOfLines, truncationType: self.truncationType, constrainedSize: constrainedSize, alignment: self.textAlignment, lineSpacing: self.lineSpacing, cutout: self.cutout, insets: self.insets, textShadowColor: self.textShadowColor, textStroke: self.textStroke))
|
||||||
let _ = apply()
|
let _ = apply()
|
||||||
@ -95,6 +99,8 @@ public class ImmediateTextNode: TextNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func updateLayoutInfo(_ constrainedSize: CGSize) -> ImmediateTextNodeLayoutInfo {
|
public func updateLayoutInfo(_ constrainedSize: CGSize) -> ImmediateTextNodeLayoutInfo {
|
||||||
|
self.constrainedSize = constrainedSize
|
||||||
|
|
||||||
let makeLayout = TextNode.asyncLayout(self)
|
let makeLayout = TextNode.asyncLayout(self)
|
||||||
let (layout, apply) = makeLayout(TextNodeLayoutArguments(attributedString: self.attributedText, backgroundColor: nil, maximumNumberOfLines: self.maximumNumberOfLines, truncationType: self.truncationType, constrainedSize: constrainedSize, alignment: self.textAlignment, lineSpacing: self.lineSpacing, cutout: self.cutout, insets: self.insets))
|
let (layout, apply) = makeLayout(TextNodeLayoutArguments(attributedString: self.attributedText, backgroundColor: nil, maximumNumberOfLines: self.maximumNumberOfLines, truncationType: self.truncationType, constrainedSize: constrainedSize, alignment: self.textAlignment, lineSpacing: self.lineSpacing, cutout: self.cutout, insets: self.insets))
|
||||||
let _ = apply()
|
let _ = apply()
|
||||||
|
|||||||
@ -283,7 +283,10 @@ private final class NavigationButtonItemNode: ImmediateTextNode {
|
|||||||
public var isEnabled: Bool = true {
|
public var isEnabled: Bool = true {
|
||||||
didSet {
|
didSet {
|
||||||
if self.isEnabled != oldValue {
|
if self.isEnabled != oldValue {
|
||||||
self.attributedText = NSAttributedString(string: text, attributes: self.attributesForCurrentState())
|
self.attributedText = NSAttributedString(string: self.text, attributes: self.attributesForCurrentState())
|
||||||
|
if let constrainedSize = self.constrainedSize {
|
||||||
|
let _ = self.updateLayout(constrainedSize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user