From 634a0581c68e01d7f5155f369e1350010e7f7e91 Mon Sep 17 00:00:00 2001 From: Remy Raes Date: Sun, 25 Sep 2022 12:39:39 +0200 Subject: feat: load northstar version in app state --- src-vue/src/plugins/store.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src-vue/src/plugins/store.ts') diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index 545f5484..98ad2342 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -3,6 +3,7 @@ import { listen, Event as TauriEvent } from "@tauri-apps/api/event"; import {Tabs} from "../utils/Tabs"; import {invoke} from "@tauri-apps/api"; import {GameInstall} from "../utils/GameInstall"; +import {ReleaseCanal} from "../utils/ReleaseCanal"; export const store = createStore({ state () { @@ -11,7 +12,7 @@ export const store = createStore({ developer_mode: false, game_path: "this/is/the/game/path", - installed_northstar_version: "1.9.7", + installed_northstar_version: "Unknown version", northstar_is_running: false, origin_is_running: false @@ -41,6 +42,9 @@ async function _initializeApp(state: any) { alert(err); }); state.game_path = result.game_path; + + // Check installed Northstar version if found + await _get_northstar_version_number_and_set_button_accordingly(state); } // TODO @@ -60,3 +64,19 @@ function _initializeListeners(state: any) { state.northstar_is_running = evt.payload as boolean; }); } + +async function _get_northstar_version_number_and_set_button_accordingly(state: any) { + let northstar_version_number: string = await invoke("get_northstar_version_number_caller", { gamePath: state.game_path }); + if (northstar_version_number && northstar_version_number.length > 0) { + state.installed_northstar_version = northstar_version_number; + + await invoke("check_is_northstar_outdated", { gamePath: state.game_path, northstarPackageName: ReleaseCanal.RELEASE }) + .then((message) => { + console.log(message); + }) + .catch((error) => { + console.error(error); + alert(error); + }); + } +} -- cgit v1.2.3