fix: start blocking the gui

This commit is contained in:
2025-03-28 23:34:04 +00:00
parent 90f36e5fa6
commit ad5a800d1b
2 changed files with 12 additions and 23 deletions

View File

@ -63,8 +63,13 @@ pub async fn startline(app: AppHandle, refresh: bool) -> Result<(), String> {
log::debug!("{}", hash);
p.line_up(hash, refresh, app.clone()).await
.map_err(|e| format!("Lineup failed:\n{}", e))?;
p.start(app.clone()).await
.map_err(|e| format!("Startup failed:\n{}", e))?;
let app_clone = app.clone();
let p_clone = p.clone();
tauri::async_runtime::spawn(async move {
if let Err(e) = p_clone.start(app_clone).await {
log::error!("Startup failed:\n{}", e);
}
});
Ok(())
} else {

View File

@ -16,7 +16,6 @@ import StartButton from './StartButton.vue';
import { invoke } from '../invoke';
import { useGeneralStore, usePkgStore, usePrfStore } from '../stores';
import { Dirs } from '../types';
import { listen } from '@tauri-apps/api/event';
const pkg = usePkgStore();
const prf = usePrfStore();
@ -28,7 +27,6 @@ const currentTab: Ref<string | number> = ref(3);
const pkgSearchTerm = ref('');
const isProfileDisabled = computed(() => prf.current === null);
const isRunning = ref(false);
onMounted(async () => {
invoke('list_directories').then((d) => {
@ -56,16 +54,6 @@ onMounted(async () => {
});
});
listen('launch-start', () => {
isRunning.value = true;
currentTab.value = 5;
});
listen('launch-end', () => {
isRunning.value = false;
currentTab.value = 0;
});
</script>
<template>
@ -78,28 +66,25 @@ listen('launch-end', () => {
>
<div class="fixed w-full flex z-100">
<TabList class="grow">
<Tab :value="3" :disabled="isRunning"
<Tab :value="3"
><div class="pi pi-question-circle"></div
></Tab>
<Tab :disabled="isProfileDisabled || isRunning" :value="0"
<Tab :disabled="isProfileDisabled" :value="0"
><div class="pi pi-box"></div
></Tab>
<Tab v-if="prf.current?.meta.game === 'chunithm'" :disabled="isRunning" :value="4"
<Tab v-if="prf.current?.meta.game === 'chunithm'" :value="4"
><div class="pi pi-ticket"></div
></Tab>
<Tab
v-if="pkg.networkStatus === 'online'"
:disabled="isProfileDisabled || isRunning"
:disabled="isProfileDisabled"
:value="1"
><div class="pi pi-download"></div
></Tab>
<Tab :disabled="isProfileDisabled || isRunning" :value="2"
<Tab :disabled="isProfileDisabled" :value="2"
><div class="pi pi-cog"></div
></Tab>
<Tab :value="5" v-if="isRunning"
><div class="pi pi-sparkles"></div
></Tab>
<div class="grow"></div>
<div class="flex gap-4">
<div class="flex" v-if="currentTab !== 3">
@ -169,7 +154,6 @@ listen('launch-end', () => {
CHUNITHM patches are not yet implemented.<br />Use
<a href=https://patcher.two-torial.xyz/ target="_blank" style="text-decoration: underline;">patcher.two-torial.xyz</a>
</TabPanel>
<TabPanel :value="5">Running!</TabPanel>
</TabPanels>
<div v-if="currentTab === 5 || currentTab === 3">
<img