|
| 1 | +import { Application } from '@nativescript/core'; |
1 | 2 | import { FirebaseApp, firebase, deserialize, FirebaseError } from '@nativescript/firebase-core';
|
2 | 3 | import { IAuthSettings, IAuth, IUser, IUserInfo, IUserMetadata, ActionCodeInfo, ActionCodeInfoOperation, UserCredential, AdditionalUserInfo, IAuthCredential, IActionCodeSettings, OAuthCredentialOptions, IOAuthCredential, IAuthTokenResult, IPhoneAuthCredential, UserProfileChangeRequest, IOAuthProvider } from './common';
|
3 | 4 |
|
@@ -526,16 +527,22 @@ function toActionCodeOperation(operation: FIRActionCodeOperation) {
|
526 | 527 | }
|
527 | 528 |
|
528 | 529 | function toUserCredential(authData: FIRAuthDataResult): UserCredential {
|
529 |
| - return { |
530 |
| - additionalUserInfo: { |
531 |
| - newUser: authData.additionalUserInfo.newUser, |
532 |
| - providerId: authData.additionalUserInfo.providerID, |
533 |
| - username: authData.additionalUserInfo.username, |
534 |
| - profile: deserialize(authData.additionalUserInfo.profile), |
535 |
| - }, |
| 530 | + const result = { |
| 531 | + additionalUserInfo: null, |
536 | 532 | user: User.fromNative(authData.user),
|
537 |
| - credential: authData.credential instanceof FIROAuthCredential ? OAuthCredential.fromNative(authData.credential) : AuthCredential.fromNative(authData.credential), |
| 533 | + credential: authData.credential instanceof FIROAuthCredential ? OAuthCredential.fromNative(authData.credential) : AuthCredential.fromNative(authData.credential) |
538 | 534 | };
|
| 535 | + |
| 536 | + if (authData?.additionalUserInfo) { |
| 537 | + result.additionalUserInfo = { |
| 538 | + newUser: authData?.additionalUserInfo?.newUser, |
| 539 | + providerId: authData?.additionalUserInfo?.providerID, |
| 540 | + username: authData?.additionalUserInfo?.username, |
| 541 | + profile: deserialize(authData?.additionalUserInfo?.profile), |
| 542 | + }; |
| 543 | + } |
| 544 | + |
| 545 | + return result; |
539 | 546 | }
|
540 | 547 |
|
541 | 548 | export class ActionCodeSettings implements IActionCodeSettings {
|
@@ -690,6 +697,8 @@ export class PhoneAuthProvider {
|
690 | 697 | reject();
|
691 | 698 | } else {
|
692 | 699 | this.native.verifyPhoneNumberUIDelegateCompletion(phoneNumber, null, (verificationId, error) => {
|
| 700 | + console.log('verifyPhoneNumberUIDelegateCompletion', verificationId, error); |
| 701 | + console.log(UIApplication.sharedApplication.delegate.respondsToSelector('application:didReceiveRemoteNotification:fetchCompletionHandler')); |
693 | 702 | if (error) {
|
694 | 703 | reject(FirebaseError.fromNative(error));
|
695 | 704 | } else {
|
|
0 commit comments