diff options
-rw-r--r-- | src/app/browser.js | 11 | ||||
-rw-r--r-- | src/app/main.js | 7 | ||||
-rw-r--r-- | src/index.js | 1 | ||||
-rw-r--r-- | src/lang/en.json | 3 | ||||
-rw-r--r-- | src/lang/fr.json | 3 |
5 files changed, 24 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")} diff --git a/src/index.js b/src/index.js index 148e30a..e01a635 100644 --- a/src/index.js +++ b/src/index.js @@ -71,6 +71,7 @@ function start() { ipcMain.on("removed-mod", (event, modname) => {send("removed-mod", modname)}); ipcMain.on("gui-getmods", (event, ...args) => {send("mods", utils.mods.list())}); ipcMain.on("installed-mod", (event, modname) => {send("installed-mod", modname)}); + ipcMain.on("no-internet", () => {send("no-internet")}); // install calls ipcMain.on("install-from-path", (event, path) => {utils.mods.install(path)}); diff --git a/src/lang/en.json b/src/lang/en.json index 9817a70..d48b3b6 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -139,6 +139,9 @@ "gui.toast.desc.malformed": "has an incorrect folder structure, if you're the developer, you should fix this.", "gui.toast.desc.failed": "An unknown error occurred while trying to install the mod. This may be the author's fault, and it may also be Viper's fault.", + "gui.toast.noInternet.title": "No Internet", + "gui.toast.noInternet.desc": "Viper may not work properly.", + "viper.menu.main": "Viper", "viper.menu.release": "Release Notes", "viper.menu.info": "Extras", diff --git a/src/lang/fr.json b/src/lang/fr.json index 9d45e1a..cd4e4dc 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -139,6 +139,9 @@ "gui.toast.desc.malformed": "a une structure de dossier incorrecte ; si vous êtes son développeur, vous devriez réparer ça.", "gui.toast.desc.failed": "Une erreur inconnue est survenue lors de l'installation du mod. Cela peut être du ressort de l'auteur du mod ou de Viper.", + "gui.toast.noInternet.title": "Pas de connexion Internet", + "gui.toast.noInternet.desc": "Viper ne fonctionnera pas correctement tant que la connexion n'est pas rétablie.", + "viper.menu.main": "Viper", "viper.menu.release": "Notes de mises à jour", "viper.menu.info": "Informations", |