diff --git a/submodules/PasscodeUI/Sources/PasscodeEntryKeyboardNode.swift b/submodules/PasscodeUI/Sources/PasscodeEntryKeyboardNode.swift index 81ff921486..384b7aa770 100644 --- a/submodules/PasscodeUI/Sources/PasscodeEntryKeyboardNode.swift +++ b/submodules/PasscodeUI/Sources/PasscodeEntryKeyboardNode.swift @@ -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, 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?, with event: UIEvent?) { + super.touchesCancelled(touches, with: event) + + self.cancelAction?() + } } private let buttonsData = [