diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-02-13 00:53:40 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-02-13 00:53:40 +0100 |
commit | c5336ec53952865af3f624a20a5c650598f2461b (patch) | |
tree | 96ce9e1c5e3743a1ebedfa3a9443a28c8ed414ff | |
parent | 1005c6551991f96103aee3ecdeb5d0753c56dc48 (diff) | |
download | FlightCore-c5336ec53952865af3f624a20a5c650598f2461b.tar.gz FlightCore-c5336ec53952865af3f624a20a5c650598f2461b.zip |
refactor: Re-use binding created from Rust code
-rw-r--r-- | src-vue/src/plugins/store.ts | 20 | ||||
-rw-r--r-- | src-vue/src/views/DeveloperView.vue | 7 |
2 files changed, 6 insertions, 21 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index e858af00..1950babb 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -6,7 +6,6 @@ import { invoke } from "@tauri-apps/api"; import { GameInstall } from "../utils/GameInstall"; import { ReleaseCanal } from "../utils/ReleaseCanal"; import { FlightCoreVersion } from "../../../src-tauri/bindings/FlightCoreVersion"; -import { LaunchOptions } from "../utils/LaunchOptions"; import { NotificationHandle } from 'element-plus'; import { NorthstarState } from '../utils/NorthstarState'; import { appDir } from '@tauri-apps/api/path'; @@ -174,18 +173,7 @@ export const store = createStore<FlightCoreStore>({ } } }, - async launchGame(state: any, passed_launch_options: LaunchOptions | null = null) { - let no_checks = false; - - if (passed_launch_options != null) { - no_checks = passed_launch_options.no_checks; - } - - const launch_options: NorthstarLaunchOptions = { - launch_via_steam: false, - bypass_checks: no_checks, - }; - + async launchGame(state: any, launch_options: NorthstarLaunchOptions = { launch_via_steam: false, bypass_checks: false}) { if (launch_options.bypass_checks) { await invoke("launch_northstar", { gameInstall: state.game_install, launchOptions: launch_options }) @@ -254,11 +242,7 @@ export const store = createStore<FlightCoreStore>({ break; } }, - async launchGameSteam(state: any, no_checks = false) { - const launch_options: NorthstarLaunchOptions = { - launch_via_steam: true, - bypass_checks: false, - }; + async launchGameSteam(state: any, launch_options: NorthstarLaunchOptions = { launch_via_steam: true, bypass_checks: false}) { await invoke("launch_northstar", { gameInstall: state.game_install, launchOptions: launch_options }) .then((message) => { showNotification('Success'); diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue index 869de2f8..1df249d3 100644 --- a/src-vue/src/views/DeveloperView.vue +++ b/src-vue/src/views/DeveloperView.vue @@ -149,7 +149,7 @@ <script lang="ts"> import { defineComponent } from "vue"; import { invoke } from "@tauri-apps/api"; -import { LaunchOptions } from "../utils/LaunchOptions"; +import { NorthstarLaunchOptions } from "../../../src-tauri/bindings/NorthstarLaunchOptions"; import { TagWrapper } from "../../../src-tauri/bindings/TagWrapper"; import { NorthstarThunderstoreReleaseWrapper } from "../../../src-tauri/bindings/NorthstarThunderstoreReleaseWrapper"; import PullRequestsSelector from "../components/PullRequestsSelector.vue"; @@ -221,11 +221,12 @@ export default defineComponent({ }); }, async launchGameWithoutChecks() { - let launch_options: LaunchOptions = { no_checks: true }; + let launch_options: NorthstarLaunchOptions = { bypass_checks: true, launch_via_steam: false }; this.$store.commit('launchGame', launch_options); }, async launchGameViaSteam() { - this.$store.commit('launchGameSteam', true); + let launch_options: NorthstarLaunchOptions = { bypass_checks: false, launch_via_steam: true }; + this.$store.commit('launchGameSteam', launch_options); }, async getInstalledMods() { await invoke("get_installed_mods_and_properties", { gameInstall: this.$store.state.game_install }).then((message) => { |