Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions OAuth/FirebaseOAuthUI/FUIOAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ @interface FUIOAuth () <ASAuthorizationControllerDelegate, ASAuthorizationContro
*/
@property(nonatomic, strong) UIColor *buttonBackgroundColor;

/** @property buttonTextColor
@brief The text color that should be used for the sign in button of the provider.
*/
@property(nonatomic, readwrite) UIColor *buttonTextColor;

/** @property scopes
@brief Array used to configure the OAuth scopes.
*/
Expand Down Expand Up @@ -118,6 +123,7 @@ - (instancetype)initWithAuthUI:(FUIAuth *)authUI
_signInLabel = buttonLabelText;
_shortName = shortName;
_buttonBackgroundColor = buttonColor;
_buttonTextColor = [UIColor whiteColor];
_icon = iconImage;
_scopes = scopes;
_customParameters = customParameters;
Expand Down Expand Up @@ -185,17 +191,26 @@ + (FUIOAuth *)yahooAuthProvider {
}

+ (FUIOAuth *)appleAuthProvider {
UIImage *iconImage = [FUIAuthUtils imageNamed:@"ic_apple"
fromBundleNameOrNil:@"FirebaseOAuthUI"];
UIColor *buttonColor = [UIColor blackColor];
UIColor *buttonTextColor = [UIColor whiteColor];
if (UITraitCollection.currentTraitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
iconImage = [iconImage imageWithTintColor:[UIColor blackColor]];
buttonColor = [UIColor whiteColor];
buttonTextColor = [UIColor blackColor];
}
FUIOAuth *provider = [[FUIOAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]
providerID:@"apple.com"
buttonLabelText:@"Sign in with Apple"
shortName:@"Apple"
buttonColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0]
iconImage:[FUIAuthUtils imageNamed:@"ic_apple"
fromBundleNameOrNil:@"FirebaseOAuthUI"]
buttonColor:buttonColor
iconImage:iconImage
scopes:@[@"name", @"email"]
customParameters:nil
loginHintKey:nil];
provider.buttonAlignment = FUIButtonAlignmentCenter;
provider.buttonTextColor = buttonTextColor;
return provider;
}

Expand All @@ -215,10 +230,6 @@ - (nullable NSString *)idToken {
return nil;
}

- (UIColor *)buttonTextColor {
return [UIColor whiteColor];
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
- (void)signInWithEmail:(nullable NSString *)email
Expand Down