aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src
diff options
context:
space:
mode:
Diffstat (limited to 'src-vue/src')
-rw-r--r--src-vue/src/plugins/store.ts55
-rw-r--r--src-vue/src/vuex-shim.d.ts2
2 files changed, 48 insertions, 9 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index af835357..e392ea27 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -9,7 +9,7 @@ import { ElNotification } from 'element-plus';
import { NorthstarState } from '../utils/NorthstarState';
-export type Store = {
+export interface FlightCoreStore {
current_tab: Tabs,
developer_mode: boolean,
game_path: string,
@@ -23,13 +23,13 @@ export type Store = {
origin_is_running: boolean
}
-export const store = createStore({
- state () {
+export const store = createStore<FlightCoreStore>({
+ state (): FlightCoreStore {
return {
current_tab: Tabs.PLAY,
developer_mode: false,
- game_path: undefined,
- install_type: undefined,
+ game_path: undefined as unknown as string,
+ install_type: undefined as unknown as InstallType,
installed_northstar_version: "",
northstar_state: NorthstarState.GAME_NOT_FOUND,
@@ -53,7 +53,7 @@ export const store = createStore({
},
initialize(state) {
_initializeApp(state);
- // _checkForFlightCoreUpdates(state);
+ _checkForFlightCoreUpdates(state);
_initializeListeners(state);
},
updateCurrentTab(state: any, newTab: Tabs) {
@@ -148,12 +148,51 @@ async function _initializeApp(state: any) {
await _get_northstar_version_number(state);
}
-// TODO
-async function _checkForFlightCoreUpdates(state: any) {
+async function _checkForFlightCoreUpdates(state: FlightCoreStore) {
// Get version number
let version_number_string = await invoke("get_version_number") as string;
// Check if up-to-date
let flightcore_is_outdated = await invoke("check_is_flightcore_outdated_caller") as boolean;
+ // Get host OS
+ let host_os_string = await invoke("get_host_os_caller") as string;
+
+ // Get install location
+ await invoke("find_game_install_location_caller", { gamePath: state.game_path })
+ .then((game_install) => {
+ // Found some gamepath
+ let game_install_obj = game_install as GameInstall;
+
+ // Change installation state based on whether game install was found
+ state.northstar_state = NorthstarState.INSTALL;
+ state.game_path = game_install_obj.game_path;
+ state.install_type = game_install_obj.install_type as InstallType;
+
+ // Check installed Northstar version if found
+ _get_northstar_version_number(state);
+ })
+ .catch((error) => {
+ // Gamepath not found or other error
+ ElNotification({
+ title: "Couldn't find game path",
+ message: error,
+ type: 'warning',
+ position: 'bottom-right'
+ });
+ state.northstar_state = NorthstarState.GAME_NOT_FOUND;
+ });
+
+ // --- This should be moved and is only placed here temporarily -----
+ let game_install = {
+ game_path: state.game_path,
+ install_type: state.install_type.toString()
+ } as GameInstall;
+ await invoke("get_log_list_caller", { gameInstall: game_install })
+ .then((message) => {
+ console.log(message);
+ })
+ .catch((error) => {
+ console.error(error);
+ });
}
/**
diff --git a/src-vue/src/vuex-shim.d.ts b/src-vue/src/vuex-shim.d.ts
index 1429115b..40438a97 100644
--- a/src-vue/src/vuex-shim.d.ts
+++ b/src-vue/src/vuex-shim.d.ts
@@ -3,6 +3,6 @@ import { Store } from 'vuex'
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
- $store: Store<State>
+ $store: Store<FlightCoreStore>
}
}