diff --git a/src/main.ts b/src/main.ts index 5256d5f..d67c18c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ -import { updateElectronApp } from "update-electron-app"; +import { IUpdateInfo, updateElectronApp } from "update-electron-app"; -import { BrowserWindow, app, shell } from "electron"; +import { BrowserWindow, app, shell, Notification } from "electron"; import started from "electron-squirrel-startup"; import { autoLaunch } from "./native/autoLaunch"; @@ -24,9 +24,19 @@ if (!config.hardwareAcceleration) { // ensure only one copy of the application can run const acquiredLock = app.requestSingleInstanceLock(); +const onNotifyUser = (_info: IUpdateInfo) => { + const notification = new Notification({ + title: 'Update Available', + body: 'Restart the app to install the update.', + silent: true + }) + + notification.show() +} + if (acquiredLock) { // start auto update logic - updateElectronApp(); + updateElectronApp({onNotifyUser}) // create and configure the app when electron is ready app.on("ready", () => {