Skip to content

Commit b26b0fa

Browse files
committed
[FirebaseUI-iOS] Update showing / hiding keyboard; update localization messages;
Change-Id: I31605721f522748974e624f18aaf7693a428dd40
1 parent 2225a4e commit b26b0fa

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

FirebaseAuthUI/FUIAuthTableViewCell.xib

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
7+
<deployment identifier="iOS"/>
78
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
89
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
910
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -19,15 +20,15 @@
1920
<autoresizingMask key="autoresizingMask"/>
2021
<subviews>
2122
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="placeholder" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="h79-sO-Wvr">
22-
<rect key="frame" x="113" y="5" width="199" height="36"/>
23+
<rect key="frame" x="116" y="5" width="196" height="36"/>
2324
<constraints>
2425
<constraint firstAttribute="height" constant="36" id="PDB-dl-J7h"/>
2526
</constraints>
2627
<fontDescription key="fontDescription" type="system" pointSize="14"/>
2728
<textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES"/>
2829
</textField>
2930
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sfp-hN-0cm">
30-
<rect key="frame" x="13" y="11.5" width="42" height="20.5"/>
31+
<rect key="frame" x="16" y="11.5" width="42" height="20.5"/>
3132
<fontDescription key="fontDescription" type="system" pointSize="17"/>
3233
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
3334
<nil key="highlightedColor"/>
@@ -38,7 +39,7 @@
3839
<constraint firstItem="h79-sO-Wvr" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="sfp-hN-0cm" secondAttribute="trailing" constant="8" id="6Ha-6g-JMJ"/>
3940
<constraint firstItem="h79-sO-Wvr" firstAttribute="baseline" secondItem="sfp-hN-0cm" secondAttribute="baseline" id="JTF-Oo-kSD"/>
4041
<constraint firstItem="sfp-hN-0cm" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="efm-ep-Ihm"/>
41-
<constraint firstItem="sfp-hN-0cm" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="5" id="fUd-Gb-DDQ"/>
42+
<constraint firstItem="sfp-hN-0cm" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="8" id="fUd-Gb-DDQ"/>
4243
<constraint firstItem="h79-sO-Wvr" firstAttribute="leading" secondItem="sfp-hN-0cm" secondAttribute="leading" priority="750" constant="100" id="tMi-c6-szU"/>
4344
<constraint firstItem="h79-sO-Wvr" firstAttribute="baseline" secondItem="sfp-hN-0cm" secondAttribute="baseline" id="xT4-wM-b1C"/>
4445
</constraints>

FirebasePhoneAuthUI/FUIPhoneEntryViewController.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ - (void)onNext:(NSString *)phoneNumber {
131131
return;
132132
}
133133

134+
[_phoneNumberField resignFirstResponder];
134135
[self incrementActivity];
135136
self.navigationItem.rightBarButtonItem.enabled = NO;
136137
FIRPhoneAuthProvider *provider = [FIRPhoneAuthProvider providerWithAuth:self.auth];
@@ -143,6 +144,8 @@ - (void)onNext:(NSString *)phoneNumber {
143144
self.navigationItem.rightBarButtonItem.enabled = YES;
144145

145146
if (error) {
147+
[_phoneNumberField becomeFirstResponder];
148+
146149
UIAlertController *alertController = [FUIPhoneAuth alertControllerForError:error
147150
actionHandler:nil];
148151
[self presentViewController:alertController animated:YES completion:nil];

FirebasePhoneAuthUI/FUIPhoneVerificationViewController.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,22 @@ - (IBAction)onResendCode:(id)sender {
128128
[_codeField clearCodeInput];
129129
[self startResendTimer];
130130
[self incrementActivity];
131+
[_codeField resignFirstResponder];
131132
FIRPhoneAuthProvider *provider = [FIRPhoneAuthProvider providerWithAuth:self.auth];
132133
[provider verifyPhoneNumber:_phoneNumber
133134
completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) {
134135

135136
[self decrementActivity];
136137
_verificationID = verificationID;
138+
[_codeField becomeFirstResponder];
137139

138140
if (error) {
139-
[self showAlertWithMessage:error.localizedDescription];
141+
UIAlertController *alertController = [FUIPhoneAuth alertControllerForError:error
142+
actionHandler:^{
143+
[_codeField clearCodeInput];
144+
[_codeField becomeFirstResponder];
145+
}];
146+
[self presentViewController:alertController animated:YES completion:nil];
140147
return;
141148
}
142149

@@ -166,6 +173,7 @@ - (void)onNext:(NSString *)verificationCode {
166173
[provider credentialWithVerificationID:_verificationID verificationCode:verificationCode];
167174

168175
[self incrementActivity];
176+
[_codeField resignFirstResponder];
169177
self.navigationItem.rightBarButtonItem.enabled = NO;
170178
FUIPhoneAuth *delegate = [self.authUI providerWithID:FIRPhoneAuthProviderID];
171179
[delegate callbackWithCredential:credential
@@ -179,6 +187,7 @@ - (void)onNext:(NSString *)verificationCode {
179187
UIAlertController *alertController = [FUIPhoneAuth alertControllerForError:error
180188
actionHandler:^{
181189
[_codeField clearCodeInput];
190+
[_codeField becomeFirstResponder];
182191
}];
183192
[self presentViewController:alertController animated:YES completion:nil];
184193
}

FirebasePhoneAuthUI/Strings/en.lproj/FirebasePhoneAuthUI.strings

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"Verify" = "Verify";
1515

1616
/* Alert message displayed when user submits empty verification code. */
17-
"EmptyVerificationCode" = "Verification code can't be empty.";
17+
"EmptyVerificationCode" = "Verification code can't be empty";
1818

1919
/* Alert message displayed when user submits empty phone number. */
20-
"EmptyPhoneNumber" = "Phone number can't be empty.";
20+
"EmptyPhoneNumber" = "Phone number can't be empty";
2121

2222
/* Label next to the left of phone number entry field. */
2323
"PhoneNumber" = "Number";
@@ -47,7 +47,7 @@
4747
"IncorrectPhoneTitle" = "Invalid phone number";
4848

4949
/* The body message of alert shown when user entered invalid phone number format. */
50-
"IncorrectPhoneMessage" = "Enter a valid phone number.";
50+
"IncorrectPhoneMessage" = "Enter a valid phone number";
5151

5252
/* The body message of alert shown when user tapped resend verification code button. */
5353
"ResendCodeResult" = "Code was sent to %@";
@@ -62,10 +62,10 @@
6262
"InternalErrorMessage" = "Something went wrong. Please try again.";
6363

6464
/* The body message of alert shown when the user has tried to send too many SMS messages. */
65-
"TooManyCodesSent" = "This phone number has been used too many times.";
65+
"TooManyCodesSent" = "This phone number has been used too many times";
6666

6767
/* The body message of alert shown when Firebase project has tried to send too many SMS messages for its price tier. */
68-
"MessageQuotaExceeded" = "There was a problem verifying your phone number.";
68+
"MessageQuotaExceeded" = "There was a problem verifying your phone number";
6969

7070
/* The body message of alert shown when the SMS confirmation code has expired, so the user should send a new one. */
71-
"MessageExpired" = "This code is no longer valid.";
71+
"MessageExpired" = "This code is no longer valid";

0 commit comments

Comments
 (0)