aboutsummaryrefslogtreecommitdiff
path: root/src-ui/src
diff options
context:
space:
mode:
Diffstat (limited to 'src-ui/src')
-rw-r--r--src-ui/src/main.ts39
1 files changed, 39 insertions, 0 deletions
diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts
index 4cbd8099..aedcceb5 100644
--- a/src-ui/src/main.ts
+++ b/src-ui/src/main.ts
@@ -1,5 +1,7 @@
import { invoke } from "@tauri-apps/api";
import { listen, Event as TauriEvent } from "@tauri-apps/api/event";
+import { open } from '@tauri-apps/api/dialog';
+import { appDir } from '@tauri-apps/api/path';
const $ = document.querySelector.bind(document);
@@ -29,6 +31,43 @@ document.addEventListener("DOMContentLoaded", async function () {
}, 500);
})
+ // omni button click
+ omniButtonEl.addEventListener("click", async function () {
+ // Check if Titanfall2 install path as found
+ let install_location = await invoke("find_game_install_location_caller") as string;
+ if (!(install_location && install_location.length > 0)) {
+ alert("Titanfall2 install not found");
+ // Open a selection dialog for directories
+ const selected = await open({
+ directory: true,
+ multiple: false,
+ defaultPath: await appDir(),
+ });
+ if (Array.isArray(selected)) {
+ // user selected multiple directories
+ alert("Please only select a single directory");
+ } else if (selected === null) {
+ // user cancelled the selection
+ } else {
+ // user selected a single directory
+ alert(selected);
+
+ globalState.gamepath = selected;
+
+ // TODO Verify if valid Titanfall2 install location
+
+ // Update omni-button
+ omniButtonEl.textContent = "Install";
+
+ // TODO Check for Northstar install
+ // TODO Check for updated Northstar
+ }
+ return;
+ }
+
+ alert("TODO");
+ });
+
// counter button click
counterButtonEl.addEventListener("pointerup", async function () {
const result = await invoke("add_count", { num: 1 }) as string;