|
13 | 13 | import ErrorDetails from '$lib/components/modals/ErrorDetails.svelte';
|
14 | 14 | import ErrorModal from '$lib/components/modals/ErrorModal.svelte';
|
15 | 15 | import ExternalInstallMod from '$lib/components/modals/ExternalInstallMod.svelte';
|
| 16 | + import MigrationModal from '$lib/components/modals/MigrationModal.svelte'; |
16 | 17 | import { supportedProgressTypes } from '$lib/components/modals/ProgressModal.svelte';
|
| 18 | + import FirstTimeSetupModal from '$lib/components/modals/first-time-setup/FirstTimeSetupModal.svelte'; |
17 | 19 | import { modalRegistry } from '$lib/components/modals/modalsRegistry';
|
18 | 20 | import ImportProfile from '$lib/components/modals/profiles/ImportProfile.svelte';
|
19 | 21 | import { isUpdateOnStart } from '$lib/components/modals/smmUpdate/smmUpdate';
|
|
23 | 25 | import { getModalStore, initializeModalStore } from '$lib/skeletonExtensions';
|
24 | 26 | import { installs, invalidInstalls, progress } from '$lib/store/ficsitCLIStore';
|
25 | 27 | import { error, expandedMod, siteURL } from '$lib/store/generalStore';
|
26 |
| - import { konami, language, updateCheckMode } from '$lib/store/settingsStore'; |
| 28 | + import { cacheDir, konami, language, updateCheckMode } from '$lib/store/settingsStore'; |
27 | 29 | import { smmUpdate, smmUpdateReady } from '$lib/store/smmUpdateStore';
|
28 | 30 | import { ExpandMod, UnexpandMod } from '$wailsjs/go/app/app';
|
| 31 | + import { NeedsSmm2Migration } from '$wailsjs/go/migration/migration'; |
| 32 | + import { GetCacheDirDiskSpaceLeft, GetNewUserSetupComplete } from '$wailsjs/go/settings/settings'; |
29 | 33 | import { Environment, EventsOn } from '$wailsjs/runtime';
|
30 | 34 |
|
31 | 35 | initializeStores();
|
|
138 | 142 | meta: {
|
139 | 143 | persistent: true,
|
140 | 144 | },
|
141 |
| - }); |
| 145 | + }); |
142 | 146 | }
|
143 | 147 | }
|
144 | 148 | }
|
145 |
| - |
| 149 | +
|
| 150 | + $: GetCacheDirDiskSpaceLeft().then((spaceLeftBytes) => { |
| 151 | + if (spaceLeftBytes < 10e9) { |
| 152 | + const spaceLeftGbReadable = (spaceLeftBytes * 1e-9).toFixed(1); |
| 153 | + $error = `The drive your cache directory is on (${$cacheDir}) is very low on disk space (Only ~${spaceLeftGbReadable} GB left). Please free up some space or move the cache directory to another drive in the Mod Manager Settings.`; |
| 154 | + } |
| 155 | + }).catch((err) => { |
| 156 | + $error = `failed to check cache directory disk space left: ${err}`; |
| 157 | + }); |
146 | 158 | $: if ($smmUpdateReady && $updateCheckMode === 'ask') {
|
147 | 159 | modalStore.trigger({
|
148 | 160 | type: 'component',
|
|
163 | 175 | $error = null;
|
164 | 176 | }
|
165 | 177 |
|
| 178 | + // Order of checks is intentional |
| 179 | + NeedsSmm2Migration().then((needsMigration) => { |
| 180 | + if (needsMigration) { |
| 181 | + modalStore.trigger({ |
| 182 | + type: 'component', |
| 183 | + component: { |
| 184 | + ref: MigrationModal, |
| 185 | + }, |
| 186 | + meta: { |
| 187 | + persistent: true, |
| 188 | + }, |
| 189 | + }); |
| 190 | + } |
| 191 | + }).then(() => { |
| 192 | + GetNewUserSetupComplete().then((wasSetupCompleted) => { |
| 193 | + if (!wasSetupCompleted) { |
| 194 | + modalStore.trigger({ |
| 195 | + type: 'component', |
| 196 | + component: { |
| 197 | + ref: FirstTimeSetupModal, |
| 198 | + }, |
| 199 | + meta: { |
| 200 | + persistent: true, |
| 201 | + }, |
| 202 | + }); |
| 203 | + } |
| 204 | + }); |
| 205 | + }); |
| 206 | +
|
166 | 207 | EventsOn('externalInstallMod', (modReference: string, version: string) => {
|
167 | 208 | if (!modReference) return;
|
168 | 209 | modalStore.trigger({
|
|
0 commit comments