From 925b6d4d302946fd8e16fa240cd3089ddd434413 Mon Sep 17 00:00:00 2001 From: Yonas Yeneneh Date: Wed, 21 Sep 2022 10:08:12 -0400 Subject: [PATCH] removing the auto-update confirmation dialog box --- electron/package.json | 2 +- electron/src/index.ts | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/electron/package.json b/electron/package.json index 6c8ddbf..c63c7fe 100644 --- a/electron/package.json +++ b/electron/package.json @@ -1,6 +1,6 @@ { "name": "unicef-pdca", - "version": "1.0.1", + "version": "1.0.0", "description": "Unicef Project Connect Daily Check App", "author": { "name": "Unicef", diff --git a/electron/src/index.ts b/electron/src/index.ts index 15e3d24..0ecc592 100644 --- a/electron/src/index.ts +++ b/electron/src/index.ts @@ -5,6 +5,7 @@ import { app, MenuItem, ipcMain, dialog } from 'electron'; import electronIsDev from 'electron-is-dev'; import unhandled from 'electron-unhandled'; import { autoUpdater } from 'electron-updater'; + import fs from 'fs-extra'; import { ElectronCapacitorApp, setupContentSecurityPolicy, setupReloadWatcher } from './setup'; const gotTheLock = app.requestSingleInstanceLock(); @@ -12,7 +13,7 @@ const gotTheLock = app.requestSingleInstanceLock(); unhandled(); let isQuiting = false; let mainWindow = null; -let isDownloaded = false; + // Define our menu templates (these are optional) const trayMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [ @@ -96,6 +97,7 @@ if (!gotTheLock) { autoUpdater.on("update-downloaded", (_event, releaseNotes, releaseName) => { + const dialogOpts = { type: 'info', buttons: ['Restart', 'Later'], @@ -103,12 +105,14 @@ if (!gotTheLock) { message: process.platform === 'win32' ? releaseNotes : releaseName, detail: 'A new version Project Connect Daily Check App has been downloaded. Restart the application to apply the updates.' }; - if (isDownloaded === false) { - dialog.showMessageBox(dialogOpts).then((returnValue) => { - isDownloaded = true; - if (returnValue.response === 0) autoUpdater.quitAndInstall(true, true) - }) - } +/* + dialog.showMessageBox(dialogOpts).then((returnValue) => { + + if (returnValue.response === 0) autoUpdater.quitAndInstall(true, true) + }) + */ + autoUpdater.quitAndInstall(true, true) + });