Fix passcode button input cancellation

This commit is contained in:
Ilya Laktyushin 2021-07-09 20:39:28 +03:00
parent cae9dcd54d
commit 8b1f004003

View File

@ -147,16 +147,11 @@ final class PasscodeEntryButtonNode: HighlightTrackingButtonNode {
}
self.addTarget(self, action: #selector(self.nop), forControlEvents: .touchUpInside)
self.addTarget(self, action: #selector(self.cancel), forControlEvents: .touchUpOutside)
}
@objc private func nop() {
}
@objc private func cancel() {
self.cancelAction?()
}
override var frame: CGRect {
get {
return super.frame
@ -209,6 +204,20 @@ final class PasscodeEntryButtonNode: HighlightTrackingButtonNode {
self.action?()
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event)
if let touchPosition = touches.first?.location(in: self.view), !self.view.bounds.contains(touchPosition) {
self.cancelAction?()
}
}
override func touchesCancelled(_ touches: Set<UITouch>?, with event: UIEvent?) {
super.touchesCancelled(touches, with: event)
self.cancelAction?()
}
}
private let buttonsData = [