From 400f534ab3c83fb9d6f43f91725423c06362cea7 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 14 Feb 2018 08:54:27 -0500 Subject: [PATCH] only update menu for certain events --- src/app/app.component.ts | 13 +++++-------- src/main/messaging.main.ts | 6 ------ src/main/window.main.ts | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 549a99f0934..27387325cd8 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -89,13 +89,12 @@ export class AppComponent implements OnInit { window.onkeypress = () => this.recordActivity(); this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => { - if (message.command !== 'updateAppMenu') { - await this.updateAppMenu(); - } - this.ngZone.run(async () => { switch (message.command) { case 'loggedIn': + case 'unlocked': + case 'loggedOut': + this.updateAppMenu(); break; case 'logout': this.logOut(!!message.expired); @@ -105,8 +104,7 @@ export class AppComponent implements OnInit { break; case 'locked': this.router.navigate(['lock']); - break; - case 'unlocked': + this.updateAppMenu(); break; case 'syncStarted': break; @@ -152,8 +150,7 @@ export class AppComponent implements OnInit { this.toasterService.popAsync('warning', this.i18nService.t('loggedOut'), this.i18nService.t('loginExpired')); } - await this.router.navigate(['login']); - this.messagingService.send('loggedOut'); + this.router.navigate(['login']); }); } diff --git a/src/main/messaging.main.ts b/src/main/messaging.main.ts index e5422f18822..33525bdafd7 100644 --- a/src/main/messaging.main.ts +++ b/src/main/messaging.main.ts @@ -45,12 +45,6 @@ export class MessagingMain { onMessage(message: any) { switch (message.command) { - case 'loggedIn': - break; - case 'logout': - break; - case 'syncCompleted': - break; case 'scheduleNextSync': this.scheduleNextSync(); break; diff --git a/src/main/window.main.ts b/src/main/window.main.ts index 588cc85e462..cb3f108330b 100644 --- a/src/main/window.main.ts +++ b/src/main/window.main.ts @@ -1,9 +1,9 @@ -import { isDev } from '../scripts/utils'; import { app, BrowserWindow, screen } from 'electron'; import * as path from 'path'; import * as url from 'url'; import { Main } from '../main'; +import { isDev } from '../scripts/utils'; export class WindowMain { win: BrowserWindow;