Worked on update dialog

This commit is contained in:
Samuel Walker 2024-06-23 15:29:35 -06:00
parent 6b497d30cd
commit fb7c632c2c
3 changed files with 11 additions and 1 deletions

View File

@ -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"] }

View File

@ -14,6 +14,10 @@
"shell": {
"all": false,
"open": true
},
"dialog": {
"all": false,
"ask": true
}
},
"windows": [

View File

@ -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;