import { SignInPage } from './../signin/signin' ; import { TranslateService } from '@ngx-translate/core' ; import { AppManager } from './../../services/AppManager' ; import { Component } from '@angular/core' ; import { NavController , ModalController } from '@ionic/angular' ; @ Component ( { templateUrl : 'profile.html' } ) export class ProfilePage { userProfile : any ; constructor ( public appManager , public nav , public translate , public modalController ) { } ionViewDidEnter ( ) { this . userProfile = this . appManager . getUserProfile ( ) ; if ( this . userProfile == null || ! this . appManager . isUserAuthenticated ( true ) ) { this . showSignInModal ( ) ; } else { this . refreshProfileView ( ) ; } this . appManager . analytics . viewEvent ( 'Profile' ) ; } refreshProfileView ( ) { this . userProfile = this . appManager . getUserProfile ( ) ; } showSignInModal ( ) { this . modalController . create ( { component : SignInPage , componentProps : { Profile : this . userProfile } } ) . then ( m => { m . onDidDismiss ( ) . then ( ( ) => { this . refreshProfileView ( ) ; } ) ; m . present ( ) ; } ) ; } close ( ) { this . modalController . dismiss ( ) ; } }