From 7dce15f553e1fe52a5c528e4e203cee99323d875 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sat, 25 Nov 2023 14:28:06 -0700 Subject: [PATCH 1/4] Only detect game path on windows --- src/ui/Main.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ui/Main.tsx b/src/ui/Main.tsx index 48db0fc4..64ec9420 100644 --- a/src/ui/Main.tsx +++ b/src/ui/Main.tsx @@ -45,6 +45,7 @@ interface IState { notification: React.ReactElement | null isGamePathSet: boolean game_install_path: string + platform: string } export class Main extends React.Component { @@ -64,6 +65,7 @@ export class Main extends React.Component { notification: null, isGamePathSet: true, game_install_path: '', + platform: '', } listen('lang_error', (payload) => { @@ -156,6 +158,10 @@ export class Main extends React.Component { migotoSet: !!(await getConfigOption('migoto_path')), }) + this.setState({ + platform: await invoke('get_platform'), + }) + if (!cert_generated) { // Generate the certificate await invoke('generate_ca_files', { @@ -222,7 +228,7 @@ export class Main extends React.Component { })) as boolean // Set no game path so the user understands it doesn't exist there - if (!game_exists) { + if (!game_exists && this.state.platform === 'windows') { setConfigOption('game_install_path', '') } From 27148eac8e95c80b505ecbc0b8a3b141da1a05a8 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sat, 25 Nov 2023 02:08:10 -0700 Subject: [PATCH 2/4] Fix wrench loading Fix game missing notification --- src/ui/Main.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ui/Main.tsx b/src/ui/Main.tsx index 64ec9420..17b5741e 100644 --- a/src/ui/Main.tsx +++ b/src/ui/Main.tsx @@ -154,6 +154,10 @@ export class Main extends React.Component { game_install_path: game_path, }) + if (this.state.game_install_path === '') { + this.setState({ isGamePathSet: false }) + } + this.setState({ migotoSet: !!(await getConfigOption('migoto_path')), }) @@ -329,7 +333,10 @@ export class Main extends React.Component { this.state.optionsOpen ? ( this.setState({ optionsOpen: !this.state.optionsOpen })} + closeFn={async () => { + this.setState({ optionsOpen: !this.state.optionsOpen }) + this.setState({ migotoSet: !!(await getConfigOption('migoto_path')) }) + }} /> ) : null } 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 3/4] Fix failing to launch on missing arg --- src/ui/Main.tsx | 55 +++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/ui/Main.tsx b/src/ui/Main.tsx index 17b5741e..cdac186f 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, '') - - // 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! - - ), - }) - - setTimeout(() => { + // Update launch args to allow launching when updating from old versions + await setConfigOption('launch_args', await getConfigOption('launch_args')) + + 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, '') + + // 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 From d11e432e76800fab620bb92f592903dfb2bbd34a Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Mon, 27 Nov 2023 15:45:21 -0700 Subject: [PATCH 4/4] Remove offline mode check Forgot offline mode wasn't merged --- src/ui/Main.tsx | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/ui/Main.tsx b/src/ui/Main.tsx index cdac186f..fb49570e 100644 --- a/src/ui/Main.tsx +++ b/src/ui/Main.tsx @@ -182,35 +182,33 @@ export class Main extends React.Component { // Update launch args to allow launching when updating from old versions await setConfigOption('launch_args', await getConfigOption('launch_args')) - 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, '') - - // Check if tagName is different than current version - if (tagName && tagName !== (await getVersion())) { - // Display notification of new release + // 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, '') + + // 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! + + ), + }) + + setTimeout(() => { this.setState({ - notification: ( - <> - Cultivation{' '} - invoke('open_in_browser', { url: latestVersion.link })}> - {latestVersion?.tag_name} - {' '} - is now available! - - ), + notification: null, }) - - setTimeout(() => { - this.setState({ - notification: null, - }) - }, 6000) - } + }, 6000) } // Period check to only show progress bar when downloading files