diff options
author | Zsika Phillip <protocol86@users.noreply.github.com> | 2018-01-08 15:40:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-08 15:40:31 -0800 |
commit | 9172e6eb7a8fe29d8b1c001ae212f935d2de3af3 (patch) | |
tree | 2976034cad8b571657f886d38dd08784d9f7770b /Example/Auth | |
parent | 0f6103e4048242aa066b4ae0e0473578b50b559c (diff) |
Adds AdditionalUserInfo to Phone Auth (#623)
Diffstat (limited to 'Example/Auth')
-rw-r--r-- | Example/Auth/Sample/MainViewController.m | 14 |
1 files changed, 11 insertions, 3 deletions
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<NSString *, NSString *> *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]; + } }]; }]; }]; |