aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorAlystrasz <contact@remyraes.com>2022-08-06 23:13:24 +0200
committerAlystrasz <contact@remyraes.com>2022-08-06 23:13:24 +0200
commit26034ec3475a61682a17c95cb2bffdbc9e52af54 (patch)
tree5c7553bc99f429f4ea9878c997c5b724f4bae492 /src/app
parent64fb444ad72bdba342a7345644a5b55d94c7f696 (diff)
downloadViper-26034ec3475a61682a17c95cb2bffdbc9e52af54.tar.gz
Viper-26034ec3475a61682a17c95cb2bffdbc9e52af54.zip
feat: display a toast message if no Internet at launch
Diffstat (limited to 'src/app')
-rw-r--r--src/app/browser.js11
-rw-r--r--src/app/main.js7
2 files changed, 17 insertions, 1 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index 4b9f2e3..b1576a9 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -391,6 +391,17 @@ ipcRenderer.on("failed-mod", (event, modname) => {
})
})
+ipcRenderer.on("no-internet", (event, modname) => {
+ console.log('yo')
+ setButtons(true);
+ new Toast({
+ timeout: 10000,
+ scheme: "error",
+ title: lang("gui.toast.noInternet.title"),
+ description: lang("gui.toast.noInternet.desc")
+ })
+})
+
ipcRenderer.on("installed-mod", (event, mod) => {
setButtons(true);
Browser.setbutton(mod.name, lang("gui.browser.reinstall"));
diff --git a/src/app/main.js b/src/app/main.js
index 4288d1d..163c63d 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -1,6 +1,6 @@
const fs = require("fs");
const path = require("path");
-const { ipcRenderer, shell } = require("electron");
+const { ipcRenderer, shell, ipcMain } = require("electron");
const lang = require("../lang");
var modsobj = {};
@@ -62,6 +62,11 @@ if (fs.existsSync("viper.json")) {
setpath();
}
+
+// Show a toast message if no Internet connection has been detected.
+if (!navigator.onLine)
+ ipcRenderer.send("no-internet");
+
function exit() {ipcRenderer.send("exit")}
function update() {ipcRenderer.send("update")}