From 37030073d8d914d94988d287a4bec354bf3e8189 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Thu, 3 Mar 2022 10:59:29 +0000 Subject: [PATCH] Just gonna do this --- src/main/base/utils.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/base/utils.ts b/src/main/base/utils.ts index 98dc3a65..126f5e15 100644 --- a/src/main/base/utils.ts +++ b/src/main/base/utils.ts @@ -2,7 +2,7 @@ import * as fs from "fs"; import * as path from "path"; import {Store} from "./store"; import {BrowserWindow as bw} from "./browserwindow"; -import {app} from "electron"; +import {app, dialog} from "electron"; import fetch from "electron-fetch"; import {AppImageUpdater, NsisUpdater} from "electron-updater"; import * as log from "electron-log"; @@ -151,9 +151,20 @@ export class utils { bw.win.webContents.send('update-response', "update-not-available"); }) - autoUpdater.on('update-downloaded', () => { + autoUpdater.on('update-downloaded', (info: any) => { console.log('[AutoUpdater] Update downloaded.') bw.win.webContents.send('update-response', "update-downloaded"); + const dialogOpts = { + type: 'info', + buttons: ['Restart', 'Later'], + title: 'Application Update', + message: info, + detail: 'A new version has been downloaded. Restart the application to apply the updates.' + } + + dialog.showMessageBox(dialogOpts).then((returnValue) => { + if (returnValue.response === 0) autoUpdater.quitAndInstall() + }) }) log.transports.file.level = "debug"