@@ -10,7 +10,6 @@ export function navigatingTo(args: EventData) {
1010 page . bindingContext = new DemoModel ( ) ;
1111}
1212
13-
1413let didInit = false ;
1514export class DemoModel extends DemoSharedFirebaseAuth {
1615 email : string ;
@@ -43,7 +42,7 @@ export class DemoModel extends DemoSharedFirebaseAuth {
4342 return ;
4443 }
4544 const user = await GoogleSignin . signIn ( ) ;
46- const cred = GoogleAuthProvider . credential ( user . idToken , user . accessToken )
45+ const cred = GoogleAuthProvider . credential ( user . idToken , user . accessToken ) ;
4746 const linked = await this . user . linkWithCredential ( cred ) ;
4847 console . log ( linked ) ;
4948 } catch ( e ) {
@@ -58,10 +57,7 @@ export class DemoModel extends DemoSharedFirebaseAuth {
5857 }
5958 try {
6059 const cred = PhoneAuthProvider . provider ( ) . credential ( this . verificationId , this . code ) ;
61- const linkedCred = await firebase ( )
62- . auth ( )
63- . currentUser
64- . linkWithCredential ( cred ) ;
60+ const linkedCred = await firebase ( ) . auth ( ) . currentUser . linkWithCredential ( cred ) ;
6561 console . log ( 'verificationId' , linkedCred ) ;
6662 } catch ( e ) {
6763 console . log ( 'linkPhone error:' , e ) ;
@@ -79,9 +75,7 @@ export class DemoModel extends DemoSharedFirebaseAuth {
7975 async loginWithPhone ( ) {
8076 try {
8177 const cred = PhoneAuthProvider . provider ( ) . credential ( this . verificationId , this . code ) ;
82- const value = await firebase ( )
83- . auth ( )
84- . signInWithCredential ( cred ) ;
78+ const value = await firebase ( ) . auth ( ) . signInWithCredential ( cred ) ;
8579 console . log ( 'verificationId' , this . verificationId ) ;
8680 console . log ( 'loginUser' , value ) ;
8781 this . _setCurrentUser ( value . user ) ;
@@ -96,6 +90,7 @@ export class DemoModel extends DemoSharedFirebaseAuth {
9690 . createUserWithEmailAndPassword ( this . email , this . password )
9791 . then ( ( user ) => {
9892 this . set ( 'user' , user ) ;
93+ user . user . sendEmailVerification ( ) ;
9994 } )
10095 . catch ( ( e ) => {
10196 console . error ( 'createUser' , e ) ;
@@ -133,25 +128,20 @@ export class DemoModel extends DemoSharedFirebaseAuth {
133128 this . _setCurrentUser ( undefined ) ;
134129 }
135130
136-
137131 loginMs ( ) {
138132 // https://firebase.google.com/docs/auth/android/microsoft-oauth#handle_the_sign-in_flow_with_the_firebase_sdk
139133
140134 const provider = new OAuthProvider ( 'microsoft.com' ) ;
141- provider . addCustomParameter ( " prompt" , " consent" ) ;
142- provider . addCustomParameter ( " login_hint" , " user@firstadd.onmicrosoft.com" ) ;
143- provider . addCustomParameter ( " tenant" , " TENANT_ID" ) ;
135+ provider . addCustomParameter ( ' prompt' , ' consent' ) ;
136+ provider . addCustomParameter ( ' login_hint' , ' user@firstadd.onmicrosoft.com' ) ;
137+ provider . addCustomParameter ( ' tenant' , ' TENANT_ID' ) ;
144138
145- provider . setScopes ( [ " mail.read" , " calendars.read" ] ) ;
139+ provider . setScopes ( [ ' mail.read' , ' calendars.read' ] ) ;
146140
147141 firebase ( )
148142 . auth ( )
149143 . signInWithProvider ( provider )
150- . then ( credentials => {
151-
152- } )
153- . catch ( err => {
154-
155- } ) ;
144+ . then ( ( credentials ) => { } )
145+ . catch ( ( err ) => { } ) ;
156146 }
157147}
0 commit comments