mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
iPad UI improvements
This commit is contained in:
@@ -29,6 +29,8 @@ public final class TextAlertContentActionNode: HighlightableButtonNode {
|
||||
|
||||
private let backgroundNode: ASDisplayNode
|
||||
|
||||
private var pointerInteraction: PointerInteraction?
|
||||
|
||||
public init(theme: AlertControllerTheme, action: TextAlertAction) {
|
||||
self.theme = theme
|
||||
self.action = action
|
||||
@@ -59,6 +61,22 @@ public final class TextAlertContentActionNode: HighlightableButtonNode {
|
||||
self.updateTheme(theme)
|
||||
}
|
||||
|
||||
public override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
self.addTarget(self, action: #selector(self.pressed), forControlEvents: .touchUpInside)
|
||||
|
||||
self.pointerInteraction = PointerInteraction(node: self, style: .hover, willEnter: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
strongSelf.backgroundNode.alpha = 0.25
|
||||
}
|
||||
}, willExit: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
strongSelf.backgroundNode.alpha = 1.0
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
public var actionEnabled: Bool = true {
|
||||
didSet {
|
||||
self.isUserInteractionEnabled = self.actionEnabled
|
||||
@@ -90,12 +108,6 @@ public final class TextAlertContentActionNode: HighlightableButtonNode {
|
||||
self.setAttributedTitle(NSAttributedString(string: self.action.title, font: font, textColor: color, paragraphAlignment: .center), for: [])
|
||||
}
|
||||
|
||||
override public func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
self.addTarget(self, action: #selector(self.pressed), forControlEvents: .touchUpInside)
|
||||
}
|
||||
|
||||
@objc func pressed() {
|
||||
self.action.action()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user