import { Component , ViewChild } from '@angular/core' ; import { Platform , Nav } from 'ionic-angular' ; import { SplashScreen } from "@ionic-native/splash-screen" ; import { StatusBar } from "@ionic-native/status-bar" ; import { GooglePlus } from '@ionic-native/google-plus' ; import { LoginPage } from '../pages/login/login' ; import { UserPage } from '../pages/user/user' ; @ Component ( { template : `<ion-nav [root]="rootPage"></ion-nav>` } ) export class MyApp { @ ViewChild ( Nav ) nav : Nav ; rootPage : any ; constructor ( platform , public splashScreen , public statusBar , public googlePlus ) { platform . ready ( ) . then ( ( ) => { this . googlePlus . trySilentLogin ( { 'scopes' : '' , 'webClientId' : 'webClientId.apps.googleusercontent.com' , 'offline' : true } ) . then ( ( data ) => { this . nav . push ( UserPage ) ; this . splashScreen . hide ( ) ; } , ( error ) => { this . nav . push ( LoginPage ) ; this . splashScreen . hide ( ) ; } ) ; this . statusBar . styleDefault ( ) ; } ) ; } }