Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Pass launch options via object #760

Merged
merged 8 commits into from
Feb 21, 2024
9 changes: 8 additions & 1 deletion src-vue/src/plugins/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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';
Expand Down Expand Up @@ -172,7 +173,13 @@ export const store = createStore<FlightCoreStore>({
}
}
},
async launchGame(state: any, no_checks = false) {
async launchGame(state: any, launch_options: LaunchOptions | null = null) {
let no_checks = false;

if (launch_options != null) {
no_checks = launch_options.no_checks;
GeckoEidechse marked this conversation as resolved.
Show resolved Hide resolved
}

if (no_checks) {
await invoke("launch_northstar", { gameInstall: state.game_install, bypassChecks: no_checks })
.then((message) => {
Expand Down
3 changes: 3 additions & 0 deletions src-vue/src/utils/LaunchOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface LaunchOptions {
no_checks: boolean,
}
4 changes: 3 additions & 1 deletion src-vue/src/views/DeveloperView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
<script lang="ts">
import { defineComponent } from "vue";
import { invoke } from "@tauri-apps/api";
import { LaunchOptions } from "../utils/LaunchOptions";
import { TagWrapper } from "../../../src-tauri/bindings/TagWrapper";
import { NorthstarThunderstoreReleaseWrapper } from "../../../src-tauri/bindings/NorthstarThunderstoreReleaseWrapper";
import PullRequestsSelector from "../components/PullRequestsSelector.vue";
Expand Down Expand Up @@ -206,7 +207,8 @@ export default defineComponent({
});
},
async launchGameWithoutChecks() {
this.$store.commit('launchGame', true);
let launch_options: LaunchOptions = { no_checks: true };
this.$store.commit('launchGame', launch_options);
},
async launchGameViaSteam() {
this.$store.commit('launchGameSteam', true);
Expand Down