From 9172e6eb7a8fe29d8b1c001ae212f935d2de3af3 Mon Sep 17 00:00:00 2001 From: Zsika Phillip Date: Mon, 8 Jan 2018 15:40:31 -0800 Subject: Adds AdditionalUserInfo to Phone Auth (#623) --- Example/Auth/Sample/MainViewController.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'Example/Auth') diff --git a/Example/Auth/Sample/MainViewController.m b/Example/Auth/Sample/MainViewController.m index f9e2273..31c103a 100644 --- a/Example/Auth/Sample/MainViewController.m +++ b/Example/Auth/Sample/MainViewController.m @@ -2715,15 +2715,23 @@ static NSDictionary *parseURL(NSString *urlString) { FIRAuthCredential *credential = [[AppManager phoneAuthProvider] credentialWithVerificationID:verificationID verificationCode:verificationCode]; - [[AppManager auth] signInWithCredential:credential - completion:^(FIRUser *_Nullable user, - NSError *_Nullable error) { + [[AppManager auth] signInAndRetrieveDataWithCredential:credential + completion:^(FIRAuthDataResult *_Nullable result, + NSError *_Nullable error) { [self hideSpinner:^{ if (error) { [self logFailure:@"failed to verify phone number" error:error]; [self showMessagePrompt:error.localizedDescription]; return; } + if (_isNewUserToggleOn) { + NSString *newUserString = result.additionalUserInfo.isNewUser ? + @"New user" : @"Existing user"; + [self showMessagePromptWithTitle:@"New or Existing" + message:newUserString + showCancelButton:NO + completion:nil]; + } }]; }]; }]; -- cgit v1.2.3