Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent double-push of edit username screen #17735

Merged
merged 1 commit into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
19.1
-----

* [*] Signup: Fixed bug where username selection screen could be pushed twice. [#17624]

19.0
-----
Expand Down
19 changes: 9 additions & 10 deletions WordPress/Classes/ViewRelated/NUX/SignupEpilogueCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -210,4 +201,12 @@ private extension SignupEpilogueCell {
}
}

func configureEditable(for cellType: EpilogueCellType) {
if cellType == .username {
cellField.isEnabled = false
} else {
cellField.isEnabled = true
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -275,8 +282,4 @@ extension SignupEpilogueTableViewController: SignupEpilogueCellDelegate {
}
}

func usernameSelected() {
delegate?.usernameTapped(userInfo: epilogueUserInfo)
}

}