From 1fc031862be9a847b2ea7d58b8ba6827cb1eeb7c Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 22 Apr 2022 12:01:11 +0100 Subject: [PATCH] Only show the check for updates menu item only if you installed OSX or Windows (Not Windows Store app) --- LogViewer.Client/src/main/appmenu.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/LogViewer.Client/src/main/appmenu.ts b/LogViewer.Client/src/main/appmenu.ts index 7dc8308c..097067c1 100644 --- a/LogViewer.Client/src/main/appmenu.ts +++ b/LogViewer.Client/src/main/appmenu.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, Menu, shell } from "electron"; +import { app, BrowserWindow, Menu, MenuItem, shell } from "electron"; import * as file from "./file"; import * as webapi from "./webapi"; import * as updater from "./app-updater"; @@ -93,6 +93,7 @@ const template: Electron.MenuItemConstructorOptions[] = [ }, { role: "help", + id: "help", submenu: [{ label: "Github Repo", click() { @@ -137,12 +138,6 @@ const template: Electron.MenuItemConstructorOptions[] = [ { label: "About", role: "about" - }, - { - label: "Check for Updates", - click: (menuItem) => { - updater.checkForUpdates(menuItem); - } }], }]; @@ -173,6 +168,18 @@ if (process.platform === 'darwin') { } const menu = Menu.buildFromTemplate(template); + +const isWindowsStore = process.windowsStore; +if(!isWindowsStore){ + let helpMenu = menu.getMenuItemById("help"); + helpMenu.submenu.append(new MenuItem({ + label: "Check for Updates", + click: (menuItem) => { + updater.checkForUpdates(menuItem); + } + })); +} + Menu.setApplicationMenu(menu); export function updateMenuEnabledState(menuId: string, enabledState: boolean):void {