1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

only update menu for certain events

This commit is contained in:
Kyle Spearrin 2018-02-14 08:54:27 -05:00
parent 3bffbbbeb3
commit 400f534ab3
3 changed files with 6 additions and 15 deletions

View File

@ -89,13 +89,12 @@ export class AppComponent implements OnInit {
window.onkeypress = () => this.recordActivity(); window.onkeypress = () => this.recordActivity();
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => { this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
if (message.command !== 'updateAppMenu') {
await this.updateAppMenu();
}
this.ngZone.run(async () => { this.ngZone.run(async () => {
switch (message.command) { switch (message.command) {
case 'loggedIn': case 'loggedIn':
case 'unlocked':
case 'loggedOut':
this.updateAppMenu();
break; break;
case 'logout': case 'logout':
this.logOut(!!message.expired); this.logOut(!!message.expired);
@ -105,8 +104,7 @@ export class AppComponent implements OnInit {
break; break;
case 'locked': case 'locked':
this.router.navigate(['lock']); this.router.navigate(['lock']);
break; this.updateAppMenu();
case 'unlocked':
break; break;
case 'syncStarted': case 'syncStarted':
break; break;
@ -152,8 +150,7 @@ export class AppComponent implements OnInit {
this.toasterService.popAsync('warning', this.i18nService.t('loggedOut'), this.toasterService.popAsync('warning', this.i18nService.t('loggedOut'),
this.i18nService.t('loginExpired')); this.i18nService.t('loginExpired'));
} }
await this.router.navigate(['login']); this.router.navigate(['login']);
this.messagingService.send('loggedOut');
}); });
} }

View File

@ -45,12 +45,6 @@ export class MessagingMain {
onMessage(message: any) { onMessage(message: any) {
switch (message.command) { switch (message.command) {
case 'loggedIn':
break;
case 'logout':
break;
case 'syncCompleted':
break;
case 'scheduleNextSync': case 'scheduleNextSync':
this.scheduleNextSync(); this.scheduleNextSync();
break; break;

View File

@ -1,9 +1,9 @@
import { isDev } from '../scripts/utils';
import { app, BrowserWindow, screen } from 'electron'; import { app, BrowserWindow, screen } from 'electron';
import * as path from 'path'; import * as path from 'path';
import * as url from 'url'; import * as url from 'url';
import { Main } from '../main'; import { Main } from '../main';
import { isDev } from '../scripts/utils';
export class WindowMain { export class WindowMain {
win: BrowserWindow; win: BrowserWindow;