From 8af788f034f858e37cff273900766f337d9ecf3d Mon Sep 17 00:00:00 2001 From: Amine Mouafik Date: Sat, 22 Feb 2020 01:59:21 +0100 Subject: Simply update locked state --- src/lib/Menu.js | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src/lib/Menu.js') diff --git a/src/lib/Menu.js b/src/lib/Menu.js index f2669a106..f66dab111 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js @@ -1,15 +1,15 @@ -import { remote, shell, clipboard } from 'electron'; -import { observable, autorun } from 'mobx'; +import { clipboard, remote, shell } from 'electron'; +import { autorun, observable } from 'mobx'; import { defineMessages } from 'react-intl'; - -import { isMac, ctrlKey, cmdKey } from '../environment'; -import { workspaceStore } from '../features/workspaces/index'; -import { workspaceActions } from '../features/workspaces/actions'; -import { announcementActions } from '../features/announcements/actions'; +import { cmdKey, ctrlKey, isMac } from '../environment'; import { announcementsStore } from '../features/announcements'; +import { announcementActions } from '../features/announcements/actions'; import { todosStore } from '../features/todos'; import { todoActions } from '../features/todos/actions'; import { CUSTOM_WEBSITE_ID } from '../features/webControls/constants'; +import { workspaceActions } from '../features/workspaces/actions'; +import { workspaceStore } from '../features/workspaces/index'; + const { app, Menu, dialog } = remote; @@ -806,21 +806,12 @@ export default class FranzMenu { accelerator: 'CmdOrCtrl+Shift+L', enabled: this.stores.user.isLoggedIn && this.stores.settings.app.lockingFeatureEnabled, click() { - // Disable lock first - otherwise the application might not update correctly actions.settings.update({ type: 'app', data: { - locked: false, + locked: true, }, }); - setTimeout(() => { - actions.settings.update({ - type: 'app', - data: { - locked: true, - }, - }); - }, 0); }, }); @@ -967,7 +958,7 @@ export default class FranzMenu { this.currentTemplate = tpl; const menu = Menu.buildFromTemplate(tpl); - const lockedMenu = Menu.buildFromTemplate([]); + const lockedMenu = new Menu(); Menu.setApplicationMenu(this.stores.user.isLoggedIn && this.stores.settings.app.locked ? lockedMenu : menu); } -- cgit v1.2.3-54-g00ecf