mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -05:00
fetch and pass uninstall info
This commit is contained in:
parent
6b82e84b7b
commit
0c66df1dc3
2 changed files with 12 additions and 8 deletions
|
|
@ -17,7 +17,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import ErrorState from "./ErrorState.svelte";
|
import ErrorState from "./ErrorState.svelte";
|
||||||
import Normal from "./Normal.svelte";
|
import Normal from "./Normal.svelte";
|
||||||
import Uninstall from "./Uninstall.svelte";
|
import Uninstall from "./Uninstall.svelte";
|
||||||
import { launcherOsUnsupported } from "@generated/ftl";
|
|
||||||
|
|
||||||
const { data }: PageProps = $props();
|
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 selectedLang = $state(data.userLocale);
|
||||||
let flow = $state(data.state);
|
let flow = $state(data.state);
|
||||||
let mirrors = $state(data.mirrors);
|
let mirrors = $state(data.mirrors);
|
||||||
|
let uninstallInfo = data.uninstallInfo;
|
||||||
|
|
||||||
async function onLangChange(lang: string) {
|
async function onLangChange(lang: string) {
|
||||||
await setLang({ val: lang });
|
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);
|
let footer: any = $state(null);
|
||||||
|
|
||||||
const uninstall = () => {
|
const uninstall = uninstallInfo.ankiProgramFilesExists
|
||||||
flow.case = "uninstall";
|
? () => {
|
||||||
};
|
flow.case = "uninstall";
|
||||||
|
}
|
||||||
|
: null;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Start bind:selectedLang {langs} {footer}>
|
<Start bind:selectedLang {langs} {footer}>
|
||||||
{#if flow.case === "normal"}
|
{#if flow.case === "normal"}
|
||||||
<Normal {mirrors} options={flow.value.options!} {uninstall} bind:footer />
|
<Normal {mirrors} options={flow.value.options!} {uninstall} bind:footer />
|
||||||
{:else if flow.case === "uninstall"}
|
{:else if flow.case === "uninstall"}
|
||||||
<Uninstall bind:footer />
|
<Uninstall {uninstallInfo} bind:footer />
|
||||||
{:else if flow.case === "osUnsupported"}
|
{:else if flow.case === "osUnsupported"}
|
||||||
<ErrorState
|
<ErrorState
|
||||||
title={$tr.launcherOsUnsupported()}
|
title={$tr.launcherOsUnsupported()}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { getLangs, getMirrors, getState } from "@generated/backend-launcher";
|
import { getLangs, getMirrors, getState, getUninstallInfo } from "@generated/backend-launcher";
|
||||||
import { ModuleName, setupI18n } from "@tslib/i18n";
|
import { ModuleName, setupI18n } from "@tslib/i18n";
|
||||||
import type { PageLoad } from "./$types";
|
import type { PageLoad } from "./$types";
|
||||||
|
|
||||||
|
|
@ -10,13 +10,15 @@ export const load = (async () => {
|
||||||
const langsPromise = getLangs({});
|
const langsPromise = getLangs({});
|
||||||
const statePromise = getState({});
|
const statePromise = getState({});
|
||||||
const mirrorsPromise = getMirrors({});
|
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,
|
i18nPromise,
|
||||||
langsPromise,
|
langsPromise,
|
||||||
statePromise,
|
statePromise,
|
||||||
mirrorsPromise,
|
mirrorsPromise,
|
||||||
|
uninstallInfoPromise,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return { langs, userLocale, state, mirrors };
|
return { langs, userLocale, state, mirrors, uninstallInfo };
|
||||||
}) satisfies PageLoad;
|
}) satisfies PageLoad;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue