Skip to content

Commit

Permalink
refactor: Pass launch options via object (#760)
Browse files Browse the repository at this point in the history
Use the existing defined interface to pass an object to store instead of just a boolean value.
Allows for further extending in the future.
  • Loading branch information
GeckoEidechse authored Feb 21, 2024
1 parent 573d8c9 commit 5a6dd62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 2 additions & 10 deletions src-vue/src/plugins/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,7 @@ export const store = createStore<FlightCoreStore>({
}
}
},
async launchGame(state: any, no_checks = false) {
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 })
Expand Down Expand Up @@ -246,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');
Expand Down
7 changes: 5 additions & 2 deletions src-vue/src/views/DeveloperView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<script lang="ts">
import { defineComponent } from "vue";
import { invoke } from "@tauri-apps/api";
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";
Expand Down Expand Up @@ -220,10 +221,12 @@ export default defineComponent({
});
},
async launchGameWithoutChecks() {
this.$store.commit('launchGame', 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) => {
Expand Down

0 comments on commit 5a6dd62

Please sign in to comment.