import { Component } from '@angular/core' ; import { Platform } from '@ionic/angular' ; import { SplashScreen } from '@ionic-native/splash-screen/ngx' ; import { StatusBar } from '@ionic-native/status-bar/ngx' ; import { AngularFireAuth } from '@angular/fire/auth' ; import { auth } from 'firebase/app' ; import { Router } from '@angular/router' ; import { ThemeService } from './services/theme.service' ; @ Component ( { selector : 'app-root' , templateUrl : 'app.component.html' } ) export class AppComponent { constructor ( private platform , private splashScreen , private statusBar , public aut , private rout , private theme ) { this . initializeApp ( ) ; if ( localStorage . getItem ( 'theme' ) === 'dark' ) { this . theme . enableDark ( ) ; } } initializeApp ( ) { this . platform . ready ( ) . then ( ( ) => { this . statusBar . styleDefault ( ) ; this . splashScreen . hide ( ) ; } ) ; this . aut . authState . subscribe ( user => { if ( user ) { } else { this . rout . navigateByUrl ( '/login' ) ; } } , ( ) => { } ) ; } }