import { Injectable } from '@angular/core' ; import { LoginUser } from '../models/user' ; import { AuthService } from './auth.service' ; import { Observable , of } from 'rxjs' ; import { take } from 'rxjs/operators' ; export let dummyUser = { id : 'some unique id' , uid : 'some unique id' , displayName : 'Tony Stark' , email : 'tony@starkindustries.com' , isAnonymous : true , photoURL : null , photoUrl : null } ; export interface OfflineAuth extends AuthService { user : LoginUser ; } @ Injectable ( ) export class OfflineAuthService implements OfflineAuth { user : LoginUser = dummyUser ; requireAuth ( ) { return of ( this . user ) ; } requireAuthOnce ( ) { return this . requireAuth ( ) . pipe ( take ( 1 ) ) ; } signInWithCredential ( credential ) { this . user . isAnonymous = false ; return of ( this . user ) ; } linkOrSignInWithGitHub ( ) { return this . signInWithCredential ( { providerId : '' , signInMethod : '' } ) ; } signOut ( ) { this . user . isAnonymous = true ; return of ( ) ; } }