diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 17:11:18 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 17:11:18 +0200 |
commit | 728f3c81320af6c97bd4217def4fdc5a0f1761d3 (patch) | |
tree | 8212ca8b57ba6e5be7ef065e64dba968def00562 /src-ui | |
parent | e9d4a9b3834cda6f1c417da322d21beca5f045a4 (diff) | |
download | FlightCore-728f3c81320af6c97bd4217def4fdc5a0f1761d3.tar.gz FlightCore-728f3c81320af6c97bd4217def4fdc5a0f1761d3.zip |
Add update functionality
Diffstat (limited to 'src-ui')
-rw-r--r-- | src-ui/src/main.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts index 4026da66..080c2e0a 100644 --- a/src-ui/src/main.ts +++ b/src-ui/src/main.ts @@ -7,6 +7,7 @@ const $ = document.querySelector.bind(document); const button_install_string = "Install Northstar"; const button_in_install_string = "Installing..."; const button_update_string = "Update Northstar"; +const button_in_update_string = "Updating..."; const button_play_string = "Launch Northstar"; const button_manual_find_string = "Manually select Titanfall2 install location"; @@ -95,10 +96,12 @@ document.addEventListener("DOMContentLoaded", async function () { omniButtonEl.addEventListener("click", async function () { switch (omniButtonEl.textContent) { + // Find Titanfall2 install manually case button_manual_find_string: manually_find_titanfall2_install(omniButtonEl); break; + // Install Northstar case button_install_string: let install_northstar_result = invoke("install_northstar_caller", { gamePath: globalState.gamepath }); @@ -117,6 +120,28 @@ document.addEventListener("DOMContentLoaded", async function () { get_northstar_version_number_and_set_button_accordingly(omniButtonEl); break; + + // Update Northstar + case button_update_string: + let update_northstar_result = invoke("update_northstar_caller", { gamePath: globalState.gamepath }); + + // Update button while update process is run + omniButtonEl.textContent = button_in_update_string; + + await update_northstar_result.then((message) => { + console.log(message); + alert("Done updating Northstar"); + }) + .catch((error) => { + console.error(error); + alert(error); + }); + + // Update button to display new version + get_northstar_version_number_and_set_button_accordingly(omniButtonEl); + break; + + // Fallback default: alert(`Not implemented yet: ${omniButtonEl.textContent}`); break; |