Skip to content

Commit def2789

Browse files
committed
fix: app delegate handling
1 parent 4619797 commit def2789

File tree

41 files changed

+1094
-773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1094
-773
lines changed

apps/demo/src/app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ messaging
5151
.catch((e) => {
5252
console.error('requestPermission', e);
5353
});
54+
55+
5456
Application.run({ moduleName: 'app-root' });

apps/demo/src/plugin-demos/firebase-auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class DemoModel extends DemoSharedFirebaseAuth {
1616
email: string;
1717
password: string;
1818
user: User;
19-
phoneNumber: string;
19+
phoneNumber: string = '18683545179';
2020
code: string;
2121
verificationId: string;
2222
constructor() {

packages/firebase-admob/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-admob",
3-
"version": "1.0.0-alpha.38",
3+
"version": "1.0.0-alpha.39",
44
"description": "NativeScript Firebase - Admob",
55
"main": "index",
66
"typings": "index.d.ts",

packages/firebase-analytics/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-analytics",
3-
"version": "1.0.0-alpha.38",
3+
"version": "1.0.0-alpha.39",
44
"description": "NativeScript Firebase - Analytics",
55
"main": "index",
66
"typings": "index.d.ts",

packages/firebase-app-check/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-app-check",
3-
"version": "1.0.0-alpha.38",
3+
"version": "1.0.0-alpha.39",
44
"description": "NativeScript Firebase - App Check",
55
"main": "index",
66
"typings": "index.d.ts",

packages/firebase-auth/index.android.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -611,16 +611,24 @@ function toActionCodeOperation(operation: com.google.firebase.auth.ActionCodeRes
611611
function toUserCredential(authData: com.google.firebase.auth.AuthResult): UserCredential {
612612
const additionalUserInfo = authData.getAdditionalUserInfo();
613613
const credential = authData.getCredential();
614-
return {
615-
additionalUserInfo: {
616-
newUser: additionalUserInfo.isNewUser(),
617-
providerId: additionalUserInfo.getProviderId(),
618-
username: additionalUserInfo.getUsername(),
619-
profile: deserialize(additionalUserInfo.getProfile()),
620-
},
614+
615+
const result = {
616+
additionalUserInfo: null,
621617
user: User.fromNative(authData.getUser()),
622618
credential: credential instanceof com.google.firebase.auth.OAuthCredential ? OAuthCredential.fromNative(credential) : AuthCredential.fromNative(credential),
623619
};
620+
621+
if (additionalUserInfo) {
622+
result.additionalUserInfo = {
623+
newUser: additionalUserInfo?.isNewUser?.(),
624+
providerId: additionalUserInfo?.getProviderId?.(),
625+
username: additionalUserInfo?.getUsername?.(),
626+
profile: deserialize(additionalUserInfo?.getProfile?.()),
627+
}
628+
};
629+
630+
631+
return result;
624632
}
625633

626634
export class ActionCodeSettings implements IActionCodeSettings {

packages/firebase-auth/index.ios.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Application } from '@nativescript/core';
12
import { FirebaseApp, firebase, deserialize, FirebaseError } from '@nativescript/firebase-core';
23
import { IAuthSettings, IAuth, IUser, IUserInfo, IUserMetadata, ActionCodeInfo, ActionCodeInfoOperation, UserCredential, AdditionalUserInfo, IAuthCredential, IActionCodeSettings, OAuthCredentialOptions, IOAuthCredential, IAuthTokenResult, IPhoneAuthCredential, UserProfileChangeRequest, IOAuthProvider } from './common';
34

@@ -526,16 +527,22 @@ function toActionCodeOperation(operation: FIRActionCodeOperation) {
526527
}
527528

528529
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,
536532
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)
538534
};
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;
539546
}
540547

541548
export class ActionCodeSettings implements IActionCodeSettings {
@@ -690,6 +697,8 @@ export class PhoneAuthProvider {
690697
reject();
691698
} else {
692699
this.native.verifyPhoneNumberUIDelegateCompletion(phoneNumber, null, (verificationId, error) => {
700+
console.log('verifyPhoneNumberUIDelegateCompletion', verificationId, error);
701+
console.log(UIApplication.sharedApplication.delegate.respondsToSelector('application:didReceiveRemoteNotification:fetchCompletionHandler'));
693702
if (error) {
694703
reject(FirebaseError.fromNative(error));
695704
} else {

packages/firebase-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-auth",
3-
"version": "1.0.0-alpha.38",
3+
"version": "1.0.0-alpha.39",
44
"description": "NativeScript Firebase - Auth",
55
"main": "index",
66
"typings": "index.d.ts",

0 commit comments

Comments
 (0)