Skip to content

Commit

Permalink
File 1
Browse files Browse the repository at this point in the history
  • Loading branch information
renkelvin committed Oct 1, 2019
1 parent 7d5cb23 commit e114a81
Showing 1 changed file with 0 additions and 66 deletions.
66 changes: 0 additions & 66 deletions Example/Auth/Sample/MainViewController+OAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ - (StaticContentTableViewSection *)oAuthSection {
return [StaticContentTableViewSection sectionWithTitle:@"OAuth" cells:@[
[StaticContentTableViewCell cellWithTitle:@"Sign in with Google"
action:^{ [weakSelf signInGoogleHeadfulLite]; }],
[StaticContentTableViewCell cellWithTitle:@"Link with Google"
action:^{ [weakSelf linkWithGoogleHeadfulLite]; }],
[StaticContentTableViewCell cellWithTitle:@"Reauthenticate with Google"
action:^{ [weakSelf reauthenticateWithGoogleHeadfulLite]; }],
[StaticContentTableViewCell cellWithTitle:@"Sign in with Twitter"
action:^{ [weakSelf signInTwitterHeadfulLite]; }],
[StaticContentTableViewCell cellWithTitle:@"Sign in with GitHub"
Expand Down Expand Up @@ -79,68 +75,6 @@ - (void)signInGoogleHeadfulLite {
}];
}

- (void)linkWithGoogleHeadfulLite {
FIROAuthProvider *provider = self.googleOAuthProvider;
provider.customParameters = @{
@"prompt" : @"consent",
};
provider.scopes = @[ @"profile", @"email", @"https://www.googleapis.com/auth/plus.me" ];
[self showSpinner:^{
[[AppManager auth].currentUser linkWithProvider:provider
UIDelegate:nil
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self hideSpinner:^{
if (error) {
[self logFailure:@"Reauthenticate with provider (Google) failed" error:error];
} else if (authResult.additionalUserInfo) {
[self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]];
if (self.isNewUserToggleOn) {
NSString *newUserString = authResult.additionalUserInfo.newUser ?
@"New user" : @"Existing user";
[self showMessagePromptWithTitle:@"New or Existing"
message:newUserString
showCancelButton:NO
completion:nil];
}
}
[self showTypicalUIForUserUpdateResultsWithTitle:@"Link Error" error:error];
}];
}];
}];
}

- (void)reauthenticateWithGoogleHeadfulLite {
FIROAuthProvider *provider = self.googleOAuthProvider;
provider.customParameters = @{
@"prompt" : @"consent",
};
provider.scopes = @[ @"profile", @"email", @"https://www.googleapis.com/auth/plus.me" ];
[self showSpinner:^{
[[AppManager auth].currentUser reauthenticateWithProvider:provider
UIDelegate:nil
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self hideSpinner:^{
if (error) {
[self logFailure:@"Link with provider (Google) failed" error:error];
} else if (authResult.additionalUserInfo) {
[self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]];
if (self.isNewUserToggleOn) {
NSString *newUserString = authResult.additionalUserInfo.newUser ?
@"New user" : @"Existing user";
[self showMessagePromptWithTitle:@"New or Existing"
message:newUserString
showCancelButton:NO
completion:nil];
}
}
[self showTypicalUIForUserUpdateResultsWithTitle:@"Reauthenticate Error" error:error];
}];
}];
}];
}

- (void)signInTwitterHeadfulLite {
FIROAuthProvider *provider = self.twitterOAuthProvider;
[self showSpinner:^{
Expand Down

0 comments on commit e114a81

Please sign in to comment.