diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 7c3b2b820c91..0fbc9583c82b 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,6 +1,6 @@ 19.1 ----- - +* [*] Signup: Fixed bug where username selection screen could be pushed twice. [#17624] 19.0 ----- diff --git a/WordPress/Classes/ViewRelated/NUX/SignupEpilogueCell.swift b/WordPress/Classes/ViewRelated/NUX/SignupEpilogueCell.swift index 49c972c4d9a9..c893ef240331 100644 --- a/WordPress/Classes/ViewRelated/NUX/SignupEpilogueCell.swift +++ b/WordPress/Classes/ViewRelated/NUX/SignupEpilogueCell.swift @@ -5,7 +5,6 @@ import WordPressAuthenticator protocol SignupEpilogueCellDelegate { func updated(value: String, forType: EpilogueCellType) func changed(value: String, forType: EpilogueCellType) - func usernameSelected() } enum EpilogueCellType: Int { @@ -105,6 +104,7 @@ class SignupEpilogueCell: UITableViewCell { configureAccessoryType(for: newCellType) configureTextContentTypeIfNeeded(for: newCellType) configureAccessibility(for: newCellType) + configureEditable(for: newCellType) addBottomBorder(withColor: .divider, leadingMargin: cellLabelLeadingConstraint.constant) @@ -137,15 +137,6 @@ extension SignupEpilogueCell: UITextFieldDelegate { } } - func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { - if let cellType = cellType, - cellType == .username { - delegate?.usernameSelected() - return false - } - return true - } - func textFieldShouldReturn(_ textField: UITextField) -> Bool { cellField.endEditing(true) return true @@ -210,4 +201,12 @@ private extension SignupEpilogueCell { } } + func configureEditable(for cellType: EpilogueCellType) { + if cellType == .username { + cellField.isEnabled = false + } else { + cellField.isEnabled = true + } + } + } diff --git a/WordPress/Classes/ViewRelated/NUX/SignupEpilogueTableViewController.swift b/WordPress/Classes/ViewRelated/NUX/SignupEpilogueTableViewController.swift index 6b516034909f..3624471b79d4 100644 --- a/WordPress/Classes/ViewRelated/NUX/SignupEpilogueTableViewController.swift +++ b/WordPress/Classes/ViewRelated/NUX/SignupEpilogueTableViewController.swift @@ -139,6 +139,13 @@ class SignupEpilogueTableViewController: UITableViewController, EpilogueUserInfo return UITableView.automaticDimension } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + if let cellType = EpilogueCellType(rawValue: indexPath.row), + cellType == .username { + delegate?.usernameTapped(userInfo: epilogueUserInfo) + } + } + } // MARK: - Private Extension @@ -275,8 +282,4 @@ extension SignupEpilogueTableViewController: SignupEpilogueCellDelegate { } } - func usernameSelected() { - delegate?.usernameTapped(userInfo: epilogueUserInfo) - } - }