feat: add update check failure dialog, ability to skip update check
This commit is contained in:
@@ -150,6 +150,8 @@
|
||||
|
||||
let downloadingUpdate = $state(false);
|
||||
|
||||
let updateCheckFailed = $state(false);
|
||||
|
||||
let dragAndDrop = useDropZone({
|
||||
onDrop: async (file) => {
|
||||
const firstFile = file[0];
|
||||
@@ -244,7 +246,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
const launch = async () => {
|
||||
const launch = async (skipUpdateCheck = false) => {
|
||||
if ($launching) return;
|
||||
launchInfo = 'Checking if osu! is already running...';
|
||||
launching.set(true);
|
||||
@@ -301,6 +303,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipUpdateCheck) {
|
||||
try {
|
||||
launchInfo = 'Looking for file updates...';
|
||||
let launchStream = $launcherStream;
|
||||
@@ -335,8 +338,10 @@
|
||||
launching.set(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (!skipUpdateCheck) {
|
||||
const streamInfo = await ezppfarm.latestBuildVersion('stable40');
|
||||
if (!streamInfo) {
|
||||
sileo.error({
|
||||
@@ -344,6 +349,7 @@
|
||||
description: 'Failed to check for updates, maybe osu! is down?',
|
||||
});
|
||||
launching.set(false);
|
||||
updateCheckFailed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -403,6 +409,7 @@
|
||||
} else {
|
||||
launchInfo = 'You are up to date!';
|
||||
}
|
||||
}
|
||||
if ($currentUser) {
|
||||
const [username, password] = await Promise.all([
|
||||
config.value<string>('username').get(''),
|
||||
@@ -1027,6 +1034,47 @@
|
||||
</AlertDialog.Content>
|
||||
</AlertDialog.Root>
|
||||
|
||||
<AlertDialog.Root open={updateCheckFailed}>
|
||||
<AlertDialog.Content
|
||||
class="bg-theme-950 border-theme-800 p-0 max-w-2xl"
|
||||
escapeKeydownBehavior="ignore"
|
||||
interactOutsideBehavior="ignore"
|
||||
>
|
||||
<div
|
||||
class="flex flex-col items-center justify-center border-b border-theme-800 bg-black/40 rounded-t-lg p-3"
|
||||
>
|
||||
<Import size={40} />
|
||||
<span class="font-semibold text-xl">Update check failed</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex flex-col items-center text-sm text-center bg-theme-900 border border-theme-800 rounded-lg mx-3 p-3"
|
||||
>
|
||||
<p class="mb-4">Failed to check for updates.</p>
|
||||
<p>Do you want to launch anyway?</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center mb-3 gap-4 mt-4">
|
||||
<Button
|
||||
class="min-w-28"
|
||||
onclick={async () => {
|
||||
await launch(true);
|
||||
updateCheckFailed = false;
|
||||
}}
|
||||
>
|
||||
Launch anyways
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
onclick={async () => {
|
||||
updateCheckFailed = false;
|
||||
}}
|
||||
>
|
||||
Abort
|
||||
</Button>
|
||||
</div>
|
||||
</AlertDialog.Content>
|
||||
</AlertDialog.Root>
|
||||
|
||||
<AlertDialog.Root open={$newVersion === undefined && !!droppedTheme && !themeInstalling}>
|
||||
<AlertDialog.Content
|
||||
class="bg-theme-950 border-theme-800 p-0 max-w-2xl"
|
||||
|
||||
Reference in New Issue
Block a user