diff options
author | 0neGal <mail@0negal.com> | 2022-01-10 17:02:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-10 17:02:55 +0100 |
commit | 9dbf85ca6655d8b14c8f0ad090a9b30e1ec951cf (patch) | |
tree | dc3659357f9e991d24c07537309fc132750272ad /src/app/main.js | |
parent | dc36aff8d0872b1fbfae265b97d8589c19d6ea5c (diff) | |
parent | 0ceea0f8699d02054ba86c8171ad834a8cdf4747 (diff) | |
download | Viper-9dbf85ca6655d8b14c8f0ad090a9b30e1ec951cf.tar.gz Viper-9dbf85ca6655d8b14c8f0ad090a9b30e1ec951cf.zip |
Merge pull request #35 from Alystrasz/fix/install-ns-on-first-launch
feat: Disable NS button when NS isn't installed
Diffstat (limited to 'src/app/main.js')
-rw-r--r-- | src/app/main.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/app/main.js b/src/app/main.js index 1678b86..c365cf4 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -3,6 +3,7 @@ const path = require("path"); const { ipcRenderer } = require("electron"); const lang = require("../lang"); +let shouldInstallNorthstar = false; var settings = { gamepath: "", @@ -43,7 +44,14 @@ function setpath(value = false) { ipcRenderer.send("setpath", value); } -function launch() {ipcRenderer.send("launch")} +function launch() { + if (shouldInstallNorthstar) { + update(); + shouldInstallNorthstar = false; + } else { + ipcRenderer.send("launch"); + } +} function launchVanilla() {ipcRenderer.send("launchVanilla")} function log(msg) { @@ -110,7 +118,11 @@ function installmod() { ipcRenderer.send("installmod") } -ipcRenderer.on("ns-updated", () => {setButtons(true)}) +ipcRenderer.on("ns-updated", () => { + setButtons(true); + northstar.disabled = false; + updateBtn.innerText = lang("gui.update"); +}) ipcRenderer.on("ns-updating", () => {setButtons(false)}) ipcRenderer.on("newpath", (event, newpath) => { @@ -150,6 +162,11 @@ ipcRenderer.on("version", (event, versions) => { for (let i = 0; i < buttons.length; i++) { buttons[i].disabled = true; } + + // Since Northstar is not installed, we cannot launch it + northstar.disabled = true; + shouldInstallNorthstar = true; + updateBtn.innerText = lang("gui.installnorthstar"); } }); ipcRenderer.send("getversion"); |