import { Injectable , NgZone } from '@angular/core' ; import { Store } from '@ngrx/store' ; import { UserActions } from '../../core/store/actions' ; import { User } from './../../shared/model' ; export interface IFirebaseLoginTypes { google : any ; facebook : any ; } @ Injectable ( ) export class FirebaseService { public loginTypes : IFirebaseLoginTypes ; constructor ( protected _store , protected _ngZone , private userActions ) { } public googleConnect ( ) { } public facebookConnect ( ) { } public getUserToken ( ) { return new Promise ( resolve => resolve ( ) ) ; } public socialLogin ( options ? ) { const provider = options ? options . type : 'unknown' ; } public connectToken ( token , user ? ) { const payload = new User ( ) ; if ( user ) { payload . displayName = user . displayName || user . name ; payload . email = user . email ; payload . userId = user . uid ; } this . _ngZone . run ( ( ) => { this . _store . dispatch ( this . userActions . loginSuccess ( payload ) ) ; } ) ; } public logout ( ) { } }