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

Add textContentType for UITextField #383

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions FirebaseAuthUI/FUIEmailEntryViewController.m 100644 → 100755
Expand Up @@ -220,6 +220,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
cell.textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
cell.textField.returnKeyType = UIReturnKeyNext;
cell.textField.keyboardType = UIKeyboardTypeEmailAddress;
if (@available(iOS 11.0, *)) {
cell.textField.textContentType = UITextContentTypeUsername;
}
[cell.textField addTarget:self
action:@selector(textFieldDidChange)
forControlEvents:UIControlEventEditingChanged];
Expand Down
3 changes: 3 additions & 0 deletions FirebaseAuthUI/FUIPasswordRecoveryViewController.m 100644 → 100755
Expand Up @@ -175,6 +175,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
_emailField.keyboardType = UIKeyboardTypeEmailAddress;
_emailField.autocorrectionType = UITextAutocorrectionTypeNo;
_emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
if (@available(iOS 11.0, *)) {
_emailField.textContentType = UITextContentTypeUsername;
}
[cell.textField addTarget:self
action:@selector(textFieldDidChange)
forControlEvents:UIControlEventEditingChanged];
Expand Down
6 changes: 6 additions & 0 deletions FirebaseAuthUI/FUIPasswordSignInViewController.m 100644 → 100755
Expand Up @@ -195,13 +195,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
_emailField.keyboardType = UIKeyboardTypeEmailAddress;
_emailField.autocorrectionType = UITextAutocorrectionTypeNo;
_emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
if (@available(iOS 11.0, *)) {
_emailField.textContentType = UITextContentTypeUsername;
}
} else if (indexPath.row == 1) {
cell.label.text = FUILocalizedString(kStr_Password);
_passwordField = cell.textField;
_passwordField.placeholder = FUILocalizedString(kStr_EnterYourPassword);
_passwordField.secureTextEntry = YES;
_passwordField.returnKeyType = UIReturnKeyNext;
_passwordField.keyboardType = UIKeyboardTypeDefault;
if (@available(iOS 11.0, *)) {
_passwordField.textContentType = UITextContentTypePassword;
}
}
[cell.textField addTarget:self
action:@selector(textFieldDidChange)
Expand Down
7 changes: 7 additions & 0 deletions FirebaseAuthUI/FUIPasswordSignUpViewController.m 100644 → 100755
Expand Up @@ -270,6 +270,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
_emailField.keyboardType = UIKeyboardTypeEmailAddress;
_emailField.autocorrectionType = UITextAutocorrectionTypeNo;
_emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
if (@available(iOS 11.0, *)) {
_emailField.textContentType = UITextContentTypeUsername;
}
} else if (indexPath.row == 1) {
cell.label.text = FUILocalizedString(kStr_Name);
cell.accessibilityIdentifier = kNameSignUpCellAccessibilityID;
Expand All @@ -278,6 +281,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
_nameField.secureTextEntry = NO;
_nameField.returnKeyType = UIReturnKeyNext;
_nameField.keyboardType = UIKeyboardTypeDefault;
_nameField.textContentType = UITextContentTypeName;
} else if (indexPath.row == 2) {
cell.label.text = FUILocalizedString(kStr_Password);
cell.accessibilityIdentifier = kPasswordSignUpCellAccessibilityID;
Expand All @@ -288,6 +292,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
_passwordField.rightViewMode = UITextFieldViewModeAlways;
_passwordField.returnKeyType = UIReturnKeyNext;
_passwordField.keyboardType = UIKeyboardTypeDefault;
if (@available(iOS 11.0, *)) {
_passwordField.textContentType = UITextContentTypePassword;
}
}
[cell.textField addTarget:self
action:@selector(textFieldDidChange)
Expand Down
3 changes: 3 additions & 0 deletions FirebaseAuthUI/FUIPasswordVerificationViewController.m 100644 → 100755
Expand Up @@ -208,6 +208,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
_passwordField.secureTextEntry = YES;
_passwordField.returnKeyType = UIReturnKeyNext;
_passwordField.keyboardType = UIKeyboardTypeDefault;
if (@available(iOS 11.0, *)) {
_passwordField.textContentType = UITextContentTypePassword;
}
[cell.textField addTarget:self
action:@selector(textFieldDidChange)
forControlEvents:UIControlEventEditingChanged];
Expand Down
1 change: 1 addition & 0 deletions FirebasePhoneAuthUI/FUIPhoneEntryViewController.m 100644 → 100755
Expand Up @@ -254,6 +254,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
_phoneNumberField.autocapitalizationType = UITextAutocapitalizationTypeNone;
_phoneNumberField.returnKeyType = UIReturnKeyNext;
_phoneNumberField.keyboardType = UIKeyboardTypeNumberPad;
_phoneNumberField.textContentType = UITextContentTypeTelephoneNumber;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UITextContentTypeTelephoneNumber seems to be only available in iOS 10+. Should we add a check for iOS 10 here?

[_phoneNumberField becomeFirstResponder];
if (_phoneNumber) {
_phoneNumberField.text = _phoneNumber.rawPhoneNumber;
Expand Down