From 572006ff95eb8f810cda3f3f6db68c55bb0ff018 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sat, 25 Nov 2023 14:54:35 -0700 Subject: [PATCH] Fix failing to launch on missing arg --- src/ui/Main.tsx | 51 +++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/ui/Main.tsx b/src/ui/Main.tsx index 17b5741..cdac186 100644 --- a/src/ui/Main.tsx +++ b/src/ui/Main.tsx @@ -179,33 +179,38 @@ export class Main extends React.Component { const updatedConfig = await getConfigOption('patch_rsa') await setConfigOption('patch_rsa', updatedConfig) - // Get latest version and compare to this version - const latestVersion: { - tag_name: string - link: string - } = await invoke('get_latest_release') - const tagName = latestVersion?.tag_name.replace(/[^\d.]/g, '') + // Update launch args to allow launching when updating from old versions + await setConfigOption('launch_args', await getConfigOption('launch_args')) - // Check if tagName is different than current version - if (tagName && tagName !== (await getVersion())) { - // Display notification of new release - this.setState({ - notification: ( - <> - Cultivation{' '} - invoke('open_in_browser', { url: latestVersion.link })}> - {latestVersion?.tag_name} - {' '} - is now available! - - ), - }) + if (!(await getConfigOption('offline_mode'))) { + // Get latest version and compare to this version + const latestVersion: { + tag_name: string + link: string + } = await invoke('get_latest_release') + const tagName = latestVersion?.tag_name.replace(/[^\d.]/g, '') - setTimeout(() => { + // Check if tagName is different than current version + if (tagName && tagName !== (await getVersion())) { + // Display notification of new release this.setState({ - notification: null, + notification: ( + <> + Cultivation{' '} + invoke('open_in_browser', { url: latestVersion.link })}> + {latestVersion?.tag_name} + {' '} + is now available! + + ), }) - }, 6000) + + setTimeout(() => { + this.setState({ + notification: null, + }) + }, 6000) + } } // Period check to only show progress bar when downloading files