From 0c66df1dc38310b92adbe99d414902352734b141 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 24 Oct 2025 19:44:41 +0800 Subject: [PATCH] fetch and pass uninstall info --- qt/launcher-gui/src/routes/+page.svelte | 12 +++++++----- qt/launcher-gui/src/routes/+page.ts | 8 +++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/qt/launcher-gui/src/routes/+page.svelte b/qt/launcher-gui/src/routes/+page.svelte index fcbd3200a..69932a936 100644 --- a/qt/launcher-gui/src/routes/+page.svelte +++ b/qt/launcher-gui/src/routes/+page.svelte @@ -17,7 +17,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import ErrorState from "./ErrorState.svelte"; import Normal from "./Normal.svelte"; import Uninstall from "./Uninstall.svelte"; - import { launcherOsUnsupported } from "@generated/ftl"; const { data }: PageProps = $props(); @@ -25,6 +24,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let selectedLang = $state(data.userLocale); let flow = $state(data.state); let mirrors = $state(data.mirrors); + let uninstallInfo = data.uninstallInfo; async function onLangChange(lang: string) { await setLang({ val: lang }); @@ -46,16 +46,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let footer: any = $state(null); - const uninstall = () => { - flow.case = "uninstall"; - }; + const uninstall = uninstallInfo.ankiProgramFilesExists + ? () => { + flow.case = "uninstall"; + } + : null; {#if flow.case === "normal"} {:else if flow.case === "uninstall"} - + {:else if flow.case === "osUnsupported"} { const langsPromise = getLangs({}); const statePromise = getState({}); const mirrorsPromise = getMirrors({}); + const uninstallInfoPromise = getUninstallInfo({}); - const [_, { userLocale, langs }, { kind: state }, { mirrors }] = await Promise.all([ + const [_, { userLocale, langs }, { kind: state }, { mirrors }, uninstallInfo] = await Promise.all([ i18nPromise, langsPromise, statePromise, mirrorsPromise, + uninstallInfoPromise, ]); - return { langs, userLocale, state, mirrors }; + return { langs, userLocale, state, mirrors, uninstallInfo }; }) satisfies PageLoad;