Skip to content

Commit

Permalink
fix(login): "We are loading you in" is not overlapped by "loading you…
Browse files Browse the repository at this point in the history
…r dashboard" anymore
  • Loading branch information
MathieuNls committed Mar 15, 2017
1 parent 48968ec commit 8c6eddf
Showing 1 changed file with 20 additions and 31 deletions.
51 changes: 20 additions & 31 deletions src/pages/login/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export class LogInPage extends LoginComponent{

laoding:Loading;
loadindSentence:string;
laodingDashboard:Loading;

constructor(
//Own injections
Expand All @@ -41,7 +40,7 @@ export class LogInPage extends LoginComponent{

GAService.screenview("LOGIN");

translate.get('logging-in').subscribe(
translate.get('loading-dashboard').subscribe(
sentence => this.loadindSentence = sentence
);

Expand Down Expand Up @@ -212,40 +211,30 @@ export class LogInPage extends LoginComponent{
/**
* Add resume event to html body and fetches up to date
* user from the API
*/
/**
* Add resume event to html body and fetches up to date
* user from the API
*/
private initOnResume(){

document.addEventListener('resume', () => {

if(this.nav.getActive().name != "SignupPage" || this.nav.getActive().name != "LoginPage"){

this.translate.get('loading-dashboard').subscribe(
sentenceLoading => {

this.laodingDashboard = this.loadingController.create({content: sentenceLoading})
this.laodingDashboard.present();

this.fetchUser().then(
user => {
this.onSuccessLogging(user)

setTimeout(()=>{
this.laodingDashboard.dismiss();
}, 500);
},
error => {
this.nav.setRoot(LogInPage);
setTimeout(()=>{
this.laodingDashboard.dismiss();
}, 500);
}
);
}
);
}

TwAPIService.resetTime();
});
if(this.nav.getActive().name != "SignupPage" && this.nav.getActive().name != "LoginPage"){
this.fetchUser().then(
user => {
DashboardPage.userChanged.emit(user)
this.loginAttempt.emit(false);
},
error => {
console.log("API Key changed");
this.loginAttempt.emit(false);
this.nav.setRoot(LogInPage);
}
);
TwAPIService.resetTime();
}
});
}

/**
Expand Down

0 comments on commit 8c6eddf

Please sign in to comment.