Skip to content

Commit a08e0db

Browse files
committed
Update FirebaseUI/Auth 2.0, synced @122472519.
Change-Id: I86e60a2eecf7a0bd00306ce2df9a17fee84808e1
1 parent 6278d39 commit a08e0db

14 files changed

+115
-109
lines changed

FirebaseUI/Auth/AuthUI/Source/FIRAuthPickerViewController.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ - (void)handleAccountLinkingForEmail:(NSString *)email
196196
if (error) {
197197
if (error.code == FIRAuthErrorCodeInvalidEmail) {
198198
// This should never happen because the email address comes from the backend.
199-
[self showAlertWithTitle:[FIRAuthUIStrings error]
200-
message:[FIRAuthUIStrings invalidEmailError]];
199+
[self showAlertWithMessage:[FIRAuthUIStrings invalidEmailError]];
201200
} else {
202201
[self.navigationController dismissViewControllerAnimated:YES completion:^{
203202
[self.authUI invokeResultCallbackWithUser:nil error:error];
@@ -207,8 +206,7 @@ - (void)handleAccountLinkingForEmail:(NSString *)email
207206
}
208207
if (!providers.count) {
209208
// This should never happen because the user must be registered.
210-
[self showAlertWithTitle:[FIRAuthUIStrings error]
211-
message:[FIRAuthUIStrings cannotAuthenticateError]];
209+
[self showAlertWithMessage:[FIRAuthUIStrings cannotAuthenticateError]];
212210
return;
213211
}
214212
NSString *bestProviderID = providers[0];
@@ -224,8 +222,7 @@ - (void)handleAccountLinkingForEmail:(NSString *)email
224222
id<FIRAuthProviderUI> bestProvider = [self providerWithID:bestProviderID];
225223
if (!bestProvider) {
226224
// Unsupported provider.
227-
[self showAlertWithTitle:[FIRAuthUIStrings error]
228-
message:[FIRAuthUIStrings cannotAuthenticateError]];
225+
[self showAlertWithMessage:[FIRAuthUIStrings cannotAuthenticateError]];
229226
return;
230227
}
231228

FirebaseUI/Auth/AuthUI/Source/FIRAuthUIBaseViewController.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,12 @@ typedef void (^FIRAuthUIAlertActionHandler)(void);
8080
*/
8181
+ (BOOL)isValidEmail:(NSString *)email;
8282

83-
/** @fn showAlertWithTitle:message:
83+
/** @fn showAlertWithMessage:
8484
@brief Displays an alert view with given title and message on top of the current view
8585
controller.
86-
@param title The title of the alert.
8786
@param message The message of the alert.
8887
*/
89-
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message;
88+
- (void)showAlertWithMessage:(NSString *)message;
9089

9190
/** @fn showSignInAlertWithEmail:provider:handler:
9291
@brief Displays an alert to conform with user whether she wants to proceed with the provider.

FirebaseUI/Auth/AuthUI/Source/FIRAuthUIBaseViewController.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ + (BOOL)isValidEmail:(NSString *)email {
185185
return [emailPredicate evaluateWithObject:email];
186186
}
187187

188-
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message {
188+
- (void)showAlertWithMessage:(NSString *)message {
189189
if ([UIAlertController class]) {
190190
UIAlertController *alertController =
191-
[UIAlertController alertControllerWithTitle:title
191+
[UIAlertController alertControllerWithTitle:nil
192192
message:message
193193
preferredStyle:UIAlertControllerStyleAlert];
194194
UIAlertAction *okAction =
@@ -199,7 +199,7 @@ - (void)showAlertWithTitle:(NSString *)title message:(NSString *)message {
199199
[self presentViewController:alertController animated:YES completion:nil];
200200
} else {
201201
UIAlertView *alert =
202-
[[UIAlertView alloc] initWithTitle:title
202+
[[UIAlertView alloc] initWithTitle:nil
203203
message:message
204204
delegate:nil
205205
cancelButtonTitle:nil

FirebaseUI/Auth/AuthUI/Source/FIRAuthUISignInButton.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ - (instancetype)initWithFrame:(CGRect)frame
7171
self.layer.shadowRadius = kDropShadowRadius;
7272
self.layer.shadowOffset = CGSizeMake(0, kDropShadowYOffset);
7373

74+
self.adjustsImageWhenHighlighted = NO;
75+
7476
return self;
7577
}
7678

FirebaseUI/Auth/AuthUI/Source/FIRAuthUIStrings.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,17 @@
8282
*/
8383
+ (NSString *)wrongPasswordError;
8484

85-
/** @fn accountDoesNotExistError
86-
@brief Error message displayed when the account does not exist.
85+
/** @fn signInTooManyTimesError
86+
@brief Error message displayed when the account is disabled.
8787
@return Localized string.
8888
*/
89-
+ (NSString *)accountDoesNotExistError;
89+
+ (NSString *)signInTooManyTimesError;
90+
91+
/** @fn userNotFoundError
92+
@brief Error message displayed when there's no account matching the email address.
93+
@return Localized string.
94+
*/
95+
+ (NSString *)userNotFoundError;
9096

9197
/** @fn accountDisabledError
9298
@brief The user account has been disabled by an administrator.
@@ -106,12 +112,6 @@
106112
*/
107113
+ (NSString *)passwordRecoveryMessage;
108114

109-
/** @fn passwordRecoveryError
110-
@brief Error message displayed when failed to recover password for an account.
111-
@return Localized string.
112-
*/
113-
+ (NSString *)passwordRecoveryError;
114-
115115
/** @fn passwordRecoveryEmailSentTitle
116116
@brief Title of a message displayed when the email for password recovery has been sent.
117117
@return Localized string.
@@ -166,25 +166,19 @@
166166
*/
167167
+ (NSString *)weakPasswordError;
168168

169+
/** @fn signUpTooManyTimesError
170+
@brief Error message displayed when many accounts have been created from same IP address.
171+
@return Localized string.
172+
*/
173+
+ (NSString *)signUpTooManyTimesError;
174+
169175
/** @fn passwordVerificationMessage
170176
@brief Message to explain to the user why password is needed for an account with this email
171177
address.
172178
@return Localized string.
173179
*/
174180
+ (NSString *)passwordVerificationMessage;
175181

176-
/** @fn error
177-
@brief Error alert title.
178-
@return Localized string.
179-
*/
180-
+ (NSString *)error;
181-
182-
/** @fn info
183-
@brief Informational alert title.
184-
@return Localized string.
185-
*/
186-
+ (NSString *)info;
187-
188182
/** @fn OK
189183
@brief OK button title.
190184
@return Localized string.
@@ -215,6 +209,12 @@
215209
*/
216210
+ (NSString *)save;
217211

212+
/** @fn send
213+
@brief Send button title.
214+
@return Localized string.
215+
*/
216+
+ (NSString *)send;
217+
218218
/** @fn email
219219
@brief Label next to a email text field.
220220
@return Localized string.

FirebaseUI/Auth/AuthUI/Source/FIRAuthUIStrings.m

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
static NSString *const kSignInTitle = @"SignInTitle";
3131
static NSString *const kEnterYourPassword = @"EnterYourPassword";
3232
static NSString *const kWrongPasswordError = @"WrongPasswordError";
33-
static NSString *const kAccountDoesNotExistError = @"AccountDoesNotExistError";
33+
static NSString *const kSignInTooManyTimesError = @"SignInTooManyTimesError";
34+
static NSString *const kUserNotFoundError = @"UserNotFoundError";
3435
static NSString *const kAccountDisabledError = @"AccountDisabledError";
3536
static NSString *const kPasswordRecoveryTitle = @"PasswordRecoveryTitle";
3637
static NSString *const kPasswordRecoveryMessage = @"PasswordRecoveryMessage";
37-
static NSString *const kPasswordRecoveryError = @"PasswordRecoveryError";
3838
static NSString *const kPasswordRecoveryEmailSentTitle = @"PasswordRecoveryEmailSentTitle";
3939
static NSString *const kPasswordRecoveryEmailSentMessage = @"PasswordRecoveryEmailSentMessage";
4040
static NSString *const kSignUpTitle = @"SignUpTitle";
@@ -44,14 +44,14 @@
4444
static NSString *const kTermsOfService = @"TermsOfService";
4545
static NSString *const kEmailAlreadyInUseError = @"EmailAlreadyInUseError";
4646
static NSString *const kWeakPasswordError = @"WeakPasswordError";
47+
static NSString *const kSignUpTooManyTimesError = @"SignUpTooManyTimesError";
4748
static NSString *const kPasswordVerificationMessage = @"PasswordVerificationMessage";
48-
static NSString *const kError = @"Error";
49-
static NSString *const kInfo = @"Info";
5049
static NSString *const kOK = @"OK";
5150
static NSString *const kCancel = @"Cancel";
5251
static NSString *const kBack = @"Back";
5352
static NSString *const kNext = @"Next";
5453
static NSString *const kSave = @"Save";
54+
static NSString *const kSend = @"Send";
5555
static NSString *const kEmail = @"Email";
5656
static NSString *const kPassword = @"Password";
5757
static NSString *const kName = @"Name";
@@ -128,8 +128,12 @@ + (NSString *)wrongPasswordError {
128128
return [self localizedStringForKey:kWrongPasswordError];
129129
}
130130

131-
+ (NSString *)accountDoesNotExistError {
132-
return [self localizedStringForKey:kAccountDoesNotExistError];
131+
+ (NSString *)signInTooManyTimesError {
132+
return [self localizedStringForKey:kSignInTooManyTimesError];
133+
}
134+
135+
+ (NSString *)userNotFoundError {
136+
return [self localizedStringForKey:kUserNotFoundError];
133137
}
134138

135139
+ (NSString *)accountDisabledError {
@@ -144,10 +148,6 @@ + (NSString *)passwordRecoveryMessage {
144148
return [self localizedStringForKey:kPasswordRecoveryMessage];
145149
}
146150

147-
+ (NSString *)passwordRecoveryError {
148-
return [self localizedStringForKey:kPasswordRecoveryError];
149-
}
150-
151151
+ (NSString *)passwordRecoveryEmailSentTitle {
152152
return [self localizedStringForKey:kPasswordRecoveryEmailSentTitle];
153153
}
@@ -184,16 +184,12 @@ + (NSString *)weakPasswordError {
184184
return [self localizedStringForKey:kWeakPasswordError];
185185
}
186186

187-
+ (NSString *)passwordVerificationMessage {
188-
return [self localizedStringForKey:kPasswordVerificationMessage];
189-
}
190-
191-
+ (NSString *)error {
192-
return [self localizedStringForKey:kError];
187+
+ (NSString *)signUpTooManyTimesError {
188+
return [self localizedStringForKey:kSignUpTooManyTimesError];
193189
}
194190

195-
+ (NSString *)info {
196-
return [self localizedStringForKey:kInfo];
191+
+ (NSString *)passwordVerificationMessage {
192+
return [self localizedStringForKey:kPasswordVerificationMessage];
197193
}
198194

199195
+ (NSString *)OK {
@@ -216,6 +212,10 @@ + (NSString *)save {
216212
return [self localizedStringForKey:kSave];
217213
}
218214

215+
+ (NSString *)send {
216+
return [self localizedStringForKey:kSend];
217+
}
218+
219219
+ (NSString *)email {
220220
return [self localizedStringForKey:kEmail];
221221
}

FirebaseUI/Auth/AuthUI/Source/FIRAuthUITableHeaderView.m

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,23 @@
1616

1717
#import "FIRAuthUITableHeaderView.h"
1818

19-
/** @var kLabelMargin
20-
@brief The margin around any @c UILabel.
19+
/** @var kLabelHorizontalMargin
20+
@brief The horizontal margin around any @c UILabel.
2121
*/
22-
static const CGFloat kLabelMargin = 8.0f;
22+
static const CGFloat kLabelHorizontalMargin = 8.0f;
23+
24+
/** @var kLabelVerticalMargin
25+
@brief The veritcal margin around any @c UILabel.
26+
*/
27+
static const CGFloat kLabelVerticalMargin = 16.0f;
2328

2429
@implementation FIRAuthUITableHeaderView
2530

2631
- (instancetype)initWithFrame:(CGRect)frame {
2732
self = [super initWithFrame:frame];
2833
if (self) {
2934
_titleLabel = [[UILabel alloc] init];
30-
_titleLabel.font = [UIFont boldSystemFontOfSize:14.0f];
35+
_titleLabel.font = [UIFont boldSystemFontOfSize:16.0f];
3136
[self addSubview:_titleLabel];
3237

3338
_detailLabel = [[UILabel alloc] init];
@@ -43,21 +48,21 @@ - (void)layoutSubviews {
4348

4449
[_titleLabel sizeToFit];
4550

46-
CGRect contentRect = CGRectInset(self.bounds, kLabelMargin, kLabelMargin);
51+
CGRect contentRect = CGRectInset(self.bounds, kLabelHorizontalMargin, kLabelVerticalMargin);
4752
CGRect titleLabelFrame, detailLabelFrame, space;
4853
CGRectDivide(contentRect, &titleLabelFrame, &contentRect,
4954
CGRectGetHeight(_titleLabel.frame), CGRectMinYEdge);
50-
CGRectDivide(contentRect, &space, &detailLabelFrame, kLabelMargin, CGRectMinYEdge);
55+
CGRectDivide(contentRect, &space, &detailLabelFrame, kLabelVerticalMargin, CGRectMinYEdge);
5156

5257
_titleLabel.frame = titleLabelFrame;
5358
_detailLabel.frame = detailLabelFrame;
5459
}
5560

5661
- (CGSize)sizeThatFits:(CGSize)size {
57-
CGFloat labelWidth = size.width - kLabelMargin * 2;
62+
CGFloat labelWidth = size.width - kLabelHorizontalMargin * 2;
5863
CGFloat titleLabelHeight = [[self class] sizeForLabel:_titleLabel maxWidth:labelWidth].height;
5964
CGFloat detailLabelHeight = [[self class] sizeForLabel:_detailLabel maxWidth:labelWidth].height;
60-
CGFloat height = titleLabelHeight + detailLabelHeight + kLabelMargin * 3;
65+
CGFloat height = titleLabelHeight + detailLabelHeight + kLabelVerticalMargin * 3;
6166
return CGSizeMake(size.width, height);
6267
}
6368

FirebaseUI/Auth/AuthUI/Source/FIRAuthUITableViewCell.xib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
33
<dependencies>
44
<deployment identifier="iOS"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
@@ -12,7 +12,7 @@
1212
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
1313
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
1414
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
15-
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
15+
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
1616
<autoresizingMask key="autoresizingMask"/>
1717
<subviews>
1818
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="placeholder" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="h79-sO-Wvr">
@@ -21,7 +21,7 @@
2121
<constraint firstAttribute="height" constant="36" id="PDB-dl-J7h"/>
2222
</constraints>
2323
<fontDescription key="fontDescription" type="system" pointSize="14"/>
24-
<textInputTraits key="textInputTraits"/>
24+
<textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES"/>
2525
</textField>
2626
<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">
2727
<rect key="frame" x="8" y="11" width="42" height="21"/>

FirebaseUI/Auth/AuthUI/Source/FIREmailEntryViewController.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ - (void)viewDidLoad {
8484

8585
- (void)next {
8686
if (![[self class] isValidEmail:_emailField.text]) {
87-
[self showAlertWithTitle:[FIRAuthUIStrings error] message:[FIRAuthUIStrings invalidEmailError]];
87+
[self showAlertWithMessage:[FIRAuthUIStrings invalidEmailError]];
8888
return;
8989
}
9090

@@ -97,8 +97,7 @@ - (void)next {
9797

9898
if (error) {
9999
if (error.code == FIRAuthErrorCodeInvalidEmail) {
100-
[self showAlertWithTitle:[FIRAuthUIStrings error]
101-
message:[FIRAuthUIStrings invalidEmailError]];
100+
[self showAlertWithMessage:[FIRAuthUIStrings invalidEmailError]];
102101
} else {
103102
[self.navigationController dismissViewControllerAnimated:YES completion:^{
104103
[self.authUI invokeResultCallbackWithUser:nil error:error];
@@ -123,8 +122,7 @@ - (void)next {
123122
} else {
124123
if (providers.count) {
125124
// There's some unsupported providers, surface the error to the user.
126-
[self showAlertWithTitle:[FIRAuthUIStrings error]
127-
message:[FIRAuthUIStrings cannotAuthenticateError]];
125+
[self showAlertWithMessage:[FIRAuthUIStrings cannotAuthenticateError]];
128126
} else {
129127
// New user.
130128
UIViewController *controller =

0 commit comments

Comments
 (0)