Allow tapping anywhere on verification code view to make first responder

This commit is contained in:
Harry 2023-05-02 06:19:08 -07:00 committed by GitHub
parent d0e0738701
commit 2fddccb8e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -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()

View File

@ -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()