import { Injectable } from '@angular/core' ; import { AngularFirestore } from '@angular/fire/firestore' ; import { Observable } from 'rxjs' ; import { map , switchMap } from 'rxjs/operators' ; import { IStats , StatsModel } from '@shared/models/index.model' ; import { ActivityService } from './activity.service' ; /**
 * Application service
 */ @ Injectable ( { providedIn : 'root' , } ) export class ApplicationService { param afs param activityService constructor ( private afs , private activityService ) { } /**
     * Find the application stats
     */ public getApplicationStats ( ) { return this . activityService . start ( ) . pipe ( switchMap ( ( ) => this . afs . collection < IStats > ( 'platform' ) . doc < IStats > ( 'stats' ) . valueChanges ( ) ) , map ( ( stats ) => new StatsModel ( stats ) ) ) ; } }