diff --git a/manager/javascripts/dcsinstance.js b/manager/javascripts/dcsinstance.js index 21f67f13..09dc577d 100644 --- a/manager/javascripts/dcsinstance.js +++ b/manager/javascripts/dcsinstance.js @@ -501,7 +501,7 @@ class DCSInstance { } catch (err) { logger.log(`An error occurred during editing: ${err}`); getManager().getActiveInstance().error = true; - + showErrorPopup(`
A critical error occurred!
Check ${getManager().getLogLocation()} for more info.
`) getManager().getMode() === "basic"? getManager().settingsPage.show(): getManager().instancesPage.show(); } @@ -599,7 +599,10 @@ class DCSInstance { getManager().instancesPage.show(); return true; } catch (err) { - logger.error(err) + logger.error(err); + + /* Nested popup calls need to wait for animation to complete */ + await sleep(300); showErrorPopup(`
An error has occurred while uninstalling the Olympus instance.
Make sure Olympus and DCS are not running.
You can find more info in ${path.join(__dirname, "..", "manager.log")}
`, () => { if (getManager().getMode() === 'basic') getManager().settingsPage.show(); diff --git a/manager/javascripts/manager.js b/manager/javascripts/manager.js index e3f85ffb..3037a5ae 100644 --- a/manager/javascripts/manager.js +++ b/manager/javascripts/manager.js @@ -116,11 +116,15 @@ class Manager { /* Ask the user for confirmation */ showConfirmPopup("
One or more of your Olympus instances are not up to date!
If you have just updated Olympus this is normal.

Press Accept and the Manager will update your instances for you.
Press Close to update your instances manually using the Installation Wizard
", async () => { try { + /* Nested popup calls need to wait for animation to complete */ await sleep(300); + await DCSInstance.fixInstances(); location.reload(); } catch (err) { logger.error(err); + + /* Nested popup calls need to wait for animation to complete */ await sleep(300); showErrorPopup(`
An error occurred while trying to fix your installations. Please reinstall Olympus manually.
You can find more info in ${this.options.logLocation}
`); } diff --git a/manager/javascripts/preload.js b/manager/javascripts/preload.js index 1261e297..3dfedad7 100644 --- a/manager/javascripts/preload.js +++ b/manager/javascripts/preload.js @@ -10,6 +10,7 @@ const AdmZip = require("adm-zip"); const { Octokit } = require('octokit'); const { logger } = require("./filesystem"); const { getManager } = require('./managerfactory'); +const { sleep } = require('./utils'); const VERSION = "{{OLYMPUS_VERSION_NUMBER}}"; logger.log(`Running in ${__dirname}`); @@ -71,7 +72,10 @@ async function updateOlympusBeta() { const date1 = new Date(artifact.updated_at); const date2 = fs.statSync(".").mtime; if (date1 > date2) { - showConfirmPopup(`
Looks like you are running a beta version of Olympus!
Latest beta artifact timestamp of: ${date1.toLocaleString()}
Your installation timestamp: ${date2.toLocaleString()}

Do you want to update to the newest beta version?
`, () => { + showConfirmPopup(`
Looks like you are running a beta version of Olympus!
Latest beta artifact timestamp of: ${date1.toLocaleString()}
Your installation timestamp: ${date2.toLocaleString()}

Do you want to update to the newest beta version?
`, async () => { + /* Nested popup calls need to wait for animation to complete */ + await sleep(300); + /* Run the browser and download the artifact */ //TODO: try and directly download the file from code rather than using the browser exec(`start https://github.com/Pax1601/DCSOlympus/actions/runs/${artifact.workflow_run.id}/artifacts/${artifact.id}`) showConfirmPopup(`
A browser window was opened to download the beta artifact.
Please wait for the download to complete, then press "Accept" and select the downloaded beta artifact.
`, @@ -222,8 +226,7 @@ const ipc = { /* From main to render. */ 'receive': [ 'event:maximized', - 'event:unmaximized', - 'check-version' + 'event:unmaximized' ], /* From render to main and back again. */ 'sendReceive': [] @@ -262,6 +265,7 @@ contextBridge.exposeInMainWorld( window.addEventListener('DOMContentLoaded', async () => { document.getElementById("loader").classList.remove("hide"); await getManager().start(); + await checkVersion(); }) window.addEventListener('resize', () => { @@ -291,8 +295,3 @@ function computePagesHeight() { pages[i].style.height = (window.innerHeight - (titleBar.clientHeight + header.clientHeight)) + "px"; } } - -ipcRenderer.on("check-version", () => { - /* Check if a new version is available */ - checkVersion(); -}) diff --git a/manager/main.js b/manager/main.js index 4ba70946..4319a3ff 100644 --- a/manager/main.js +++ b/manager/main.js @@ -38,7 +38,6 @@ function createWindow() { electronApp.on('ready', () => { window = createWindow(); - window.webContents.send('check-version') }); electronApp.on('window-all-closed', () => {