Skip to content

Commit 4e8613f

Browse files
hmhmshChuan Ren
authored andcommitted
Fix requireDisplayname handling (#705)
1 parent 7fbab2b commit 4e8613f

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

EmailAuth/FirebaseEmailAuthUI/FUIPasswordSignUpViewController.m

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,32 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
283283
_emailField.textContentType = UITextContentTypeUsername;
284284
}
285285
} else if (indexPath.row == 1) {
286-
cell.label.text = FUILocalizedString(kStr_Name);
287-
cell.accessibilityIdentifier = kNameSignUpCellAccessibilityID;
288-
_nameField = cell.textField;
289-
_nameField.placeholder = FUILocalizedString(kStr_FirstAndLastName);
290-
_nameField.secureTextEntry = NO;
291-
_nameField.returnKeyType = UIReturnKeyNext;
292-
_nameField.keyboardType = UIKeyboardTypeDefault;
293-
_nameField.autocapitalizationType = UITextAutocapitalizationTypeWords;
294-
if (@available(iOS 10.0, *)) {
295-
_nameField.textContentType = UITextContentTypeName;
296-
}
286+
if (_requireDisplayName) {
287+
cell.label.text = FUILocalizedString(kStr_Name);
288+
cell.accessibilityIdentifier = kNameSignUpCellAccessibilityID;
289+
_nameField = cell.textField;
290+
_nameField.placeholder = FUILocalizedString(kStr_FirstAndLastName);
291+
_nameField.secureTextEntry = NO;
292+
_nameField.returnKeyType = UIReturnKeyNext;
293+
_nameField.keyboardType = UIKeyboardTypeDefault;
294+
_nameField.autocapitalizationType = UITextAutocapitalizationTypeWords;
295+
if (@available(iOS 10.0, *)) {
296+
_nameField.textContentType = UITextContentTypeName;
297+
}
298+
} else {
299+
cell.label.text = FUILocalizedString(kStr_Password);
300+
cell.accessibilityIdentifier = kPasswordSignUpCellAccessibilityID;
301+
_passwordField = cell.textField;
302+
_passwordField.placeholder = FUILocalizedString(kStr_ChoosePassword);
303+
_passwordField.secureTextEntry = YES;
304+
_passwordField.rightView = [self visibilityToggleButtonForPasswordField];
305+
_passwordField.rightViewMode = UITextFieldViewModeAlways;
306+
_passwordField.returnKeyType = UIReturnKeyNext;
307+
_passwordField.keyboardType = UIKeyboardTypeDefault;
308+
if (@available(iOS 11.0, *)) {
309+
_passwordField.textContentType = UITextContentTypePassword;
310+
}
311+
}
297312
} else if (indexPath.row == 2) {
298313
cell.label.text = FUILocalizedString(kStr_Password);
299314
cell.accessibilityIdentifier = kPasswordSignUpCellAccessibilityID;
@@ -307,18 +322,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
307322
if (@available(iOS 11.0, *)) {
308323
_passwordField.textContentType = UITextContentTypePassword;
309324
}
310-
} else if (indexPath.row == 2) {
311-
cell.label.text = FUILocalizedString(kStr_Name);
312-
cell.accessibilityIdentifier = kNameSignUpCellAccessibilityID;
313-
_nameField = cell.textField;
314-
_nameField.placeholder = FUILocalizedString(kStr_FirstAndLastName);
315-
_nameField.secureTextEntry = NO;
316-
_nameField.returnKeyType = UIReturnKeyNext;
317-
_nameField.keyboardType = UIKeyboardTypeDefault;
318-
_nameField.autocapitalizationType = UITextAutocapitalizationTypeWords;
319-
if (@available(iOS 10.0, *)) {
320-
_nameField.textContentType = UITextContentTypeName;
321-
}
322325
}
323326
[cell.textField addTarget:self
324327
action:@selector(textFieldDidChange)

0 commit comments

Comments
 (0)