import { Component , ChangeDetectorRef , ViewChild , ViewContainerRef } from '@angular/core' ; import { Platform , NavController } from '@ionic/angular' ; import { SplashScreen } from '@ionic-native/splash-screen/ngx' ; import { StatusBar } from '@ionic-native/status-bar/ngx' ; import { UserService } from 'src/app/core/services/user.service' ; import { ViewService } from './core/services/view.service' ; import { NoticeService } from './core/services/notice.service' ; import { PusherService } from './core/services/pusher.service' ; import { UpdateService } from './core/services/update.service' ; import { DeviceConfigService } from './core/services/device-config.service' ; import { DataService } from './core/services/data.service' ; import { DeviceService } from './core/services/device.service' ; import { AuthService } from './core/services/auth.service' ; import { NetworkService } from './core/services/network.service' ; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx' ; import { ImageService } from './core/services/image.service' ; import { ToastService } from './core/services/toast.service' ; import { TipService } from './core/services/tip.service' ; import { TranslationService } from './core/services/translation.service' ; @ Component ( { selector : 'app-root' , templateUrl : 'app.component.html' } ) export class AppComponent { isPWA ; get swipeEnable ( ) { return this . viewService . swipeEnable ; } get toastList ( ) { return this . toastService . list ; } get tipList ( ) { return this . tipService . list ; } constructor ( private platform , private splashScreen , private statusBar , private viewService , private authService , private userService , private dataService , private noticeService , private pusherService , private updateService , private networkService , private deviceConfigService , private navCtrl , private deviceService , private screenOrientation , private imageService , private toastService , private tipService , private translationService ) { } ngOnInit ( ) { this . initApp ( ) ; } ngAfterViewInit ( ) { this . initService ( ) ; } initApp ( ) { this . platform . ready ( ) . then ( ( ) => { if ( this . platform . is ( "cordova" ) ) { this . statusBar . overlaysWebView ( true ) ; this . screenOrientation . lock ( this . screenOrientation . ORIENTATIONS . PORTRAIT ) ; this . updateService . checkUpdate ( ) ; this . splashScreen . hide ( ) ; } else { this . isPWA = true ; } } ) ; } async initService ( ) { await this . dataService . init ( ) ; this . viewService . init ( ) ; this . checkLoginStatus ( ) ; this . authService . init ( ) ; this . deviceConfigService . init ( ) ; this . deviceService . init ( ) ; this . networkService . init ( ) ; this . noticeService . init ( ) ; this . pusherService . init ( ) ; this . imageService . init ( ) ; this . translationService . init ( ) ; } checkLoginStatus ( ) { if ( this . authService . isLogin ( ) ) { this . userService . getAllInfo ( ) ; } else { this . navCtrl . navigateRoot ( '/login' ) ; } } }