import { Component , ViewChild } from '@angular/core' ; import { Nav , Platform , MenuController } from 'ionic-angular' ; import { StatusBar } from '@ionic-native/status-bar' ; import { SplashScreen } from '@ionic-native/splash-screen' ; import * as moment from 'moment' ; import { HomePage } from '../pages/home/home' ; import { HistoryPage } from '../pages/history/history' ; import { LicensePage } from '../pages/license/license' ; import { HistoryService } from '../services/history' ; import { AboutPage } from '../pages/about/about' ; import { AndroidFullScreen } from '@ionic-native/android-full-screen' ; @ Component ( { templateUrl : 'app.html' } ) export class MyApp { @ ViewChild ( Nav ) nav : Nav ; rootPage : any = HomePage ; pages : any [ ] ; constructor ( public platform , public statusBar , public splashScreen , public history , public androidFullScreen , public menuCtrl ) { this . initializeApp ( ) ; this . setPages ( ) ; } initializeApp ( ) { moment . locale ( 'zh-cn' ) ; const enterHome = ( ) => { this . statusBar . styleDefault ( ) ; this . splashScreen . hide ( ) ; } ; this . platform . ready ( ) . then ( ( ) => { if ( this . platform . is ( 'android' ) ) { this . androidFullScreen . isImmersiveModeSupported ( ) . then ( err => { console . log ( err ) ; return this . androidFullScreen . immersiveMode ( ) ; } ) . then ( enterHome ) . catch ( enterHome ) ; } else { enterHome ( ) ; } } ) ; } async setPages ( ) { this . pages = [ { title : '撕下的页面' , img : 'menu-toren-pages.png' , component : HistoryPage } , { title : '字体版权说明' , img : 'menu-license.png' , component : LicensePage } , { title : '关于「2019 字体日历」' , img : 'menu-about.png' , component : AboutPage } ] ; } openPage ( page ) { this . nav . push ( page . component ) ; this . menuCtrl . close ( ) ; } }