diff --git a/FCLauncher/src-tauri/Cargo.toml b/FCLauncher/src-tauri/Cargo.toml index 0e403a3..d64c3b3 100644 --- a/FCLauncher/src-tauri/Cargo.toml +++ b/FCLauncher/src-tauri/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" tauri-build = { version = "1", features = [] } [dependencies] -tauri = { version = "1", features = ["shell-open"] } +tauri = { version = "1", features = [ "dialog-ask", "shell-open"] } serde = { version = "1", features = ["derive"] } serde_json = "1" suppaftp = { version = "6.0.1", features = ["native-tls"] } diff --git a/FCLauncher/src-tauri/tauri.conf.json b/FCLauncher/src-tauri/tauri.conf.json index 88b914b..727dd50 100644 --- a/FCLauncher/src-tauri/tauri.conf.json +++ b/FCLauncher/src-tauri/tauri.conf.json @@ -14,6 +14,10 @@ "shell": { "all": false, "open": true + }, + "dialog": { + "all": false, + "ask": true } }, "windows": [ diff --git a/FCLauncher/src/main.js b/FCLauncher/src/main.js index aeb1fca..5abe690 100644 --- a/FCLauncher/src/main.js +++ b/FCLauncher/src/main.js @@ -1,5 +1,6 @@ const { invoke } = window.__TAURI__.tauri; const { listen } = window.__TAURI__.event; +const { ask } = window.__TAURI__.dialog; //import { listen } from '@tauri-apps/api'; let greetInputEl; @@ -20,6 +21,10 @@ const download_finished = listen("download_finished", (event) => { document.getElementById("launchGame").disabled = false; }); +const update_dialog = listen("update_dialog", (event) => { + ask("Do you want to update?", {title: "Update Available", type: "Message"}).then((value) => { if (value) { invoke("update").then(window.close()); } }); +}); + window.addEventListener("DOMContentLoaded", () => { document.getElementById("launchGame").addEventListener("click", gameLaunch); @@ -57,6 +62,7 @@ function addModpacks(modpacks) { dropdown.options.add(opt); } } + function gameLaunch() { var packId = document.getElementById("Modpacks"); var selectedId = packId.value;