diff --git a/frontend/apps/desktop/src/auto-update.ts b/frontend/apps/desktop/src/auto-update.ts index 41ffee14bd..a798aec0b0 100644 --- a/frontend/apps/desktop/src/auto-update.ts +++ b/frontend/apps/desktop/src/auto-update.ts @@ -1,5 +1,12 @@ import {IS_PROD_DESKTOP} from '@mintter/shared' -import {app, autoUpdater, ipcMain, ipcRenderer} from 'electron' +import { + MessageBoxOptions, + app, + autoUpdater, + dialog, + ipcMain, + ipcRenderer, +} from 'electron' import log from 'electron-log/main' import {ipcMainEvents} from './ipc-events' @@ -88,21 +95,21 @@ function setup() { autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { log.debug('[MAIN][AUTO-UPDATE]: New version downloaded') - // const dialogOpts: MessageBoxOptions = { - // type: 'info', - // buttons: ['Restart', 'Later'], - // title: 'Application Update', - // message: process.platform == 'win32' ? releaseNotes : releaseName, - // detail: - // 'A new version has been downloaded. Restart the application to apply the updates.', - // } - - // dialog.showMessageBox(dialogOpts).then((returnValue: any) => { - // log.debug('[MAIN][AUTO-UPDATE]: Quit and Install') - // if (returnValue.response === 0) autoUpdater.quitAndInstall() - // }) - - // ipcMain.emit(ipcMainEvents.UPDATE_DOWNLOADED) + const dialogOpts: MessageBoxOptions = { + type: 'info', + buttons: ['Restart', 'Later'], + title: 'Application Update', + message: process.platform == 'win32' ? releaseNotes : releaseName, + detail: + 'A new version has been downloaded. Restart the application to apply the updates.', + } + + dialog.showMessageBox(dialogOpts).then((returnValue: any) => { + log.debug('[MAIN][AUTO-UPDATE]: Quit and Install') + if (returnValue.response === 0) autoUpdater.quitAndInstall() + }) + + ipcMain.emit(ipcMainEvents.UPDATE_DOWNLOADED) ipcRenderer.emit(ipcMainEvents.UPDATE_DOWNLOADED) }) diff --git a/frontend/apps/desktop/src/main.ts b/frontend/apps/desktop/src/main.ts index 7255701f69..ed1d901702 100644 --- a/frontend/apps/desktop/src/main.ts +++ b/frontend/apps/desktop/src/main.ts @@ -12,8 +12,8 @@ import { } from './app-api' import {createAppMenu} from './app-menu' import {initPaths} from './app-paths' -// import autoUpdate from './auto-update' -import {setupUpdates} from './update' +import autoUpdate from './auto-update' +// import {setupUpdates} from './update' import {startMainDaemon} from './daemon' import {saveCidAsFile} from './save-cid-as-file' @@ -41,8 +41,8 @@ startMainDaemon() Menu.setApplicationMenu(createAppMenu()) -// autoUpdate() -setupUpdates() +autoUpdate() +// setupUpdates() //Simple logging module Electron/Node.js/NW.js application. No dependencies. No complicated configuration. log.initialize({ diff --git a/frontend/packages/app/components/titlebar-windows-linux.tsx b/frontend/packages/app/components/titlebar-windows-linux.tsx index 50e7f865e9..6a2637125f 100644 --- a/frontend/packages/app/components/titlebar-windows-linux.tsx +++ b/frontend/packages/app/components/titlebar-windows-linux.tsx @@ -155,6 +155,11 @@ export function SystemMenu() { id: 'mintter', title: 'Mintter', children: [ + { + id: 'updates', + title: 'Check for updates', + onSelect: () => triggerFocusedWindow('checkForUpdates'), + }, { id: 'preferences', title: 'Preferences...', @@ -413,7 +418,7 @@ type SubMenuItemElement = { id: string title: string onSelect: () => void - icon: ListItemProps['icon'] + icon?: ListItemProps['icon'] accelerator?: string disabled?: boolean } diff --git a/frontend/packages/app/utils/window-events.ts b/frontend/packages/app/utils/window-events.ts index b8252cb3b3..54dbbe1c13 100644 --- a/frontend/packages/app/utils/window-events.ts +++ b/frontend/packages/app/utils/window-events.ts @@ -6,6 +6,7 @@ export type AppWindowSimpleEvent = | 'forward' | 'triggerPeerSync' | 'openQuickSwitcher' + | 'checkForUpdates' export type AppWindowEvent = | AppWindowSimpleEvent