Skip to content

Commit

Permalink
removing the auto-update confirmation dialog box
Browse files Browse the repository at this point in the history
  • Loading branch information
sanoylab committed Sep 21, 2022
1 parent 02e1e0d commit 925b6d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 11 additions & 7 deletions electron/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ 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();
// Graceful handling of unhandled errors.
unhandled();
let isQuiting = false;
let mainWindow = null;
let isDownloaded = false;


// Define our menu templates (these are optional)
const trayMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [
Expand Down Expand Up @@ -96,19 +97,22 @@ if (!gotTheLock) {


autoUpdater.on("update-downloaded", (_event, releaseNotes, releaseName) => {

const dialogOpts = {
type: 'info',
buttons: ['Restart', 'Later'],
title: 'Project Connect Daily Check App Update',
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)

});


Expand Down

0 comments on commit 925b6d4

Please sign in to comment.