Prevent double-push of edit username screen #17735
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #17624
Description
The edit username screen on the SignupEpilogue screen was sometimes pushed twice when a user tapped on the username text field.
This navigation was triggered in the implementation of
UITextFieldDelegate.textFieldShouldBeginEditing
, which was under certain circumstances, called twice by the system. That delegate method is supposed to answer the question "should editing be allowed?" with a Bool, so navigating here could be considered a side-effect, which makes the delegate method unsafe to call more than once.This change moves the responsibility for navigation to the TableViewController, in the
didSelectRowAtIndex
method.The
UITextField
for username also needed to be disabled, to make it easier to tap the row. Without this change, the user would have to tap on the "Username:" label, or the disclosure indicator, and taps on the text field would be ignored. Prior to this commit, users would have to tap on the username value itself, taps elsewhere on the row were ignored.To test:
multi-push-fixed.mp4
Regression Notes
Potential unintended areas of impact
Editability of other
SignupEpilogueCell
s – the cell is not used on any other screensAccessibility – action and label
What I did to test those areas of impact (or what existing automated tests I relied on)
Checked that Password and Display Name were still editable, before and after pushing the username selection screen (and multiple repeats in case of cell reuse)
Checked accessibility label was useful and showed that the row was selectable ("button"). Accessibility action still pushes username screen.
None – no existing tests found, idempotent testing of signup is a high barrier to entry for this small change.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.