From 2fddccb8e32abad7a2644e0003bbc19d806b438c Mon Sep 17 00:00:00 2001 From: Harry <109690906+harry-signal@users.noreply.github.com> Date: Tue, 2 May 2023 06:19:08 -0700 Subject: [PATCH] Allow tapping anywhere on verification code view to make first responder --- .../Registration/RegistrationVerificationCodeView.swift | 7 +++++++ .../RegistrationVerificationViewController.swift | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Signal/src/ViewControllers/Registration/RegistrationVerificationCodeView.swift b/Signal/src/ViewControllers/Registration/RegistrationVerificationCodeView.swift index f1fe99152d..aff3824621 100644 --- a/Signal/src/ViewControllers/Registration/RegistrationVerificationCodeView.swift +++ b/Signal/src/ViewControllers/Registration/RegistrationVerificationCodeView.swift @@ -140,6 +140,8 @@ class RegistrationVerificationCodeView: UIView { self.addSubview(textfield) updateColors() + + addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(didTapView))) } public func updateColors() { @@ -202,6 +204,11 @@ class RegistrationVerificationCodeView: UIView { textfield.selectedTextRange = textfield.textRange(from: newPosition, to: newPosition) } + @objc + private func didTapView() { + becomeFirstResponder() + } + @discardableResult public override func becomeFirstResponder() -> Bool { return textfield.becomeFirstResponder() diff --git a/Signal/src/ViewControllers/Registration/RegistrationVerificationViewController.swift b/Signal/src/ViewControllers/Registration/RegistrationVerificationViewController.swift index 2b96e6e7b3..b73b3e1429 100644 --- a/Signal/src/ViewControllers/Registration/RegistrationVerificationViewController.swift +++ b/Signal/src/ViewControllers/Registration/RegistrationVerificationViewController.swift @@ -214,11 +214,7 @@ class RegistrationVerificationViewController: OWSViewController { public override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - if !UIDevice.current.isIPhone5OrShorter { - // Small devices may obscure parts of the UI behind the keyboard, especially with larger - // font sizes. - verificationCodeView.becomeFirstResponder() - } + verificationCodeView.becomeFirstResponder() showValidationErrorUiIfNecessary()