Skip to content

Commit 044badf

Browse files
committed
fix(auth): set time on phone builder
1 parent ef015a2 commit 044badf

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

packages/firebase-auth/index.android.ts

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {deserialize, firebase, FirebaseApp, FirebaseError} from '@nativescript/firebase-core';
1+
import { deserialize, firebase, FirebaseApp, FirebaseError } from '@nativescript/firebase-core';
22
import {
33
ActionCodeInfo,
44
ActionCodeInfoOperation,
@@ -18,23 +18,23 @@ import {
1818
AdditionalUserInfo
1919
} from './common';
2020
import lazy from '@nativescript/core/utils/lazy';
21-
import {Application} from '@nativescript/core';
21+
import { Application } from '@nativescript/core';
2222

23-
export {AdditionalUserInfo, ActionCodeInfo, ActionCodeInfoOperation, UserCredential, UserProfileChangeRequest};
23+
export { AdditionalUserInfo, ActionCodeInfo, ActionCodeInfoOperation, UserCredential, UserProfileChangeRequest };
2424

2525
let defaultAuth: Auth;
2626
const fb = firebase();
2727
Object.defineProperty(fb, 'auth', {
28-
value: (app?: FirebaseApp) => {
29-
if (!app) {
30-
if (!defaultAuth) {
31-
defaultAuth = new Auth();
32-
}
33-
return defaultAuth;
34-
}
35-
return new Auth(app);
36-
},
37-
writable: false,
28+
value: (app?: FirebaseApp) => {
29+
if (!app) {
30+
if (!defaultAuth) {
31+
defaultAuth = new Auth();
32+
}
33+
return defaultAuth;
34+
}
35+
return new Auth(app);
36+
},
37+
writable: false,
3838
});
3939

4040

@@ -684,9 +684,17 @@ export class PhoneAuthProvider {
684684
static provider(auth?: Auth) {
685685
const provider = new PhoneAuthProvider();
686686
if (auth) {
687-
provider.#native = com.google.firebase.auth.PhoneAuthOptions.newBuilder(auth.native);
687+
provider.#native = com.google.firebase.auth.PhoneAuthOptions
688+
.newBuilder(auth.native)
689+
.setTimeout(
690+
long(60), java.util.concurrent.TimeUnit.SECONDS
691+
);
688692
} else {
689-
provider.#native = com.google.firebase.auth.PhoneAuthOptions.newBuilder();
693+
provider.#native = com.google.firebase.auth.PhoneAuthOptions
694+
.newBuilder()
695+
.setTimeout(
696+
long(60), java.util.concurrent.TimeUnit.SECONDS
697+
);
690698
}
691699

692700
provider.#native.setActivity(Application.android.foregroundActivity || Application.android.startActivity);
@@ -888,7 +896,7 @@ export class Auth implements IAuth {
888896
if (app?.native) {
889897
this.#native = com.google.firebase.auth.FirebaseAuth.getInstance(app.native);
890898
} else {
891-
if(defaultAuth){
899+
if (defaultAuth) {
892900
return defaultAuth;
893901
}
894902
defaultAuth = this;

0 commit comments

Comments
 (0)