Skip to content

Commit 858c353

Browse files
committed
Update FirebaseUI/Auth 2.0, synced @122079078.
Change-Id: I7bce0d3b7bb0b1e04be1301dfe38c1cb162af047
1 parent 43b6bc8 commit 858c353

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1049
-227
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading
Loading

FirebaseUI/Auth/AuthProviderUI/Facebook/Source/FIRFacebookAuthUI.m

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
*/
2929
static NSString *const kBundleFileName = @"FirebaseFacebookAuthUIBundle.bundle";
3030

31+
/** @var kTableName
32+
@brief The name of the strings table to search for localized strings.
33+
*/
34+
static NSString *const kTableName = @"FirebaseFacebookAuthUI";
35+
3136
/** @var kSignInWithFacebook
3237
@brief The string key for localized button text.
3338
*/
@@ -98,7 +103,7 @@ + (UIImage *)imageNamed:(NSString *)name {
98103
*/
99104
+ (NSString *)localizedStringForKey:(NSString *)key {
100105
NSBundle *frameworkBundle = [[self class] frameworkBundle];
101-
return [frameworkBundle localizedStringForKey:key value:nil table:@"FirebaseFacebookAuthUI"];
106+
return [frameworkBundle localizedStringForKey:key value:nil table:kTableName];
102107
}
103108

104109
#pragma mark - FIRAuthProviderUI
@@ -115,9 +120,22 @@ - (NSString *)signInLabel {
115120
return [[self class] localizedStringForKey:kSignInWithFacebook];
116121
}
117122

118-
- (void)FIRAuth:(FIRAuth *)auth
119-
signInWithPresentingViewController:(nullable UIViewController *)presentingViewController
120-
completion:(nullable FIRAuthProviderSignInCompletionBlock)completion {
123+
- (UIImage *)icon {
124+
return [[self class] imageNamed:@"ic_facebook"];
125+
}
126+
127+
- (UIColor *)buttonBackgroundColor {
128+
return [UIColor colorWithRed:59.0f/255.0f green:89.0f/255.0f blue:152.0f/255.0f alpha:1.0f];
129+
}
130+
131+
- (UIColor *)buttonTextColor {
132+
return [UIColor whiteColor];
133+
}
134+
135+
- (void)signInWithAuth:(FIRAuth *)auth
136+
email:(nullable NSString *)email
137+
presentingViewController:(nullable UIViewController *)presentingViewController
138+
completion:(nullable FIRAuthProviderSignInCompletionBlock)completion {
121139
_pendingSignInCallback = completion;
122140
[_loginManager logInWithReadPermissions:_scopes
123141
fromViewController:presentingViewController
@@ -138,7 +156,7 @@ - (void)FIRAuth:(FIRAuth *)auth
138156
}];
139157
}
140158

141-
- (void)FIRAuthSignOut:(FIRAuth *)auth {
159+
- (void)signOutWithAuth:(FIRAuth *)auth {
142160
[_loginManager logOut];
143161
}
144162

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading
Loading

FirebaseUI/Auth/AuthProviderUI/Google/Source/FIRGoogleAuthUI.m

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
*/
3737
static NSString *const kGooglePlusScopesPrefix = @"https://www.googleapis.com/auth/plus.";
3838

39+
/** @var kTableName
40+
@brief The name of the strings table to search for localized strings.
41+
*/
42+
static NSString *const kTableName = @"FirebaseGoogleAuthUI";
43+
3944
/** @var kSignInWithGoogle
4045
@brief The string key for localized button text.
4146
*/
@@ -107,7 +112,7 @@ + (UIImage *)imageNamed:(NSString *)name {
107112
*/
108113
+ (NSString *)localizedStringForKey:(NSString *)key {
109114
NSBundle *frameworkBundle = [[self class] frameworkBundle];
110-
return [frameworkBundle localizedStringForKey:key value:nil table:@"FirebaseGoogleAuthUI"];
115+
return [frameworkBundle localizedStringForKey:key value:nil table:kTableName];
111116
}
112117

113118
#pragma mark - FIRAuthProviderUI
@@ -124,16 +129,37 @@ - (NSString *)signInLabel {
124129
return [[self class] localizedStringForKey:kSignInWithGoogle];
125130
}
126131

127-
- (void)FIRAuth:(FIRAuth *)auth
128-
signInWithPresentingViewController:(nullable UIViewController *)presentingViewController
129-
completion:(nullable FIRAuthProviderSignInCompletionBlock)completion {
132+
- (UIImage *)icon {
133+
return [[self class] imageNamed:@"ic_google"];
134+
}
135+
136+
- (UIColor *)buttonBackgroundColor {
137+
return [UIColor whiteColor];
138+
}
139+
140+
- (UIColor *)buttonTextColor {
141+
return [UIColor colorWithWhite:0 alpha:0.54f];
142+
}
143+
144+
- (void)signInWithAuth:(FIRAuth *)auth
145+
email:(nullable NSString *)email
146+
presentingViewController:(nullable UIViewController *)presentingViewController
147+
completion:(nullable FIRAuthProviderSignInCompletionBlock)completion {
130148
_presentingViewController = presentingViewController;
131-
_pendingSignInCallback = completion;
149+
132150
GIDSignIn *signIn = [self configuredGoogleSignIn];
151+
_pendingSignInCallback = ^(FIRAuthCredential *_Nullable credential, NSError *_Nullable error) {
152+
signIn.loginHint = nil;
153+
if (completion) {
154+
completion(credential, error);
155+
}
156+
};
157+
158+
signIn.loginHint = email;
133159
[signIn signIn];
134160
}
135161

136-
- (void)FIRAuthSignOut:(FIRAuth *)auth {
162+
- (void)signOutWithAuth:(FIRAuth *)auth {
137163
GIDSignIn *signIn = [self configuredGoogleSignIn];
138164
[signIn signOut];
139165
}
@@ -191,23 +217,6 @@ - (GIDSignIn *)configuredGoogleSignIn {
191217
return signIn;
192218
}
193219

194-
/** @fn clientIsRequestingGoogleSocialScopes
195-
@brief Indicates the games scope or a plus.* scope (with the exception of plus.me) is included
196-
in the additional scopes being requested for the google provider in the stared FIRAuth
197-
instance.
198-
@return YES if the client is requesting a social scope.
199-
*/
200-
- (BOOL)clientIsRequestingGoogleSocialScopes {
201-
for (NSString *scope in _scopes) {
202-
if ([scope isEqualToString:kGoogleGamesScope] ||
203-
([scope rangeOfString:kGooglePlusScopesPrefix].location != NSNotFound
204-
&& ![scope isEqualToString:kGooglePlusMeScope])) {
205-
return YES;
206-
}
207-
}
208-
return NO;
209-
}
210-
211220
/** @fn callbackWithCredential:error:
212221
@brief Ends the sign-in flow by cleaning up and calling back with given credential or error.
213222
@param credential The credential to pass back, if any.
228 Bytes
Loading
351 Bytes
Loading
493 Bytes
Loading

0 commit comments

Comments
 (0)