Skip to content

Commit

Permalink
Fix failing to launch on missing arg
Browse files Browse the repository at this point in the history
  • Loading branch information
NotThorny committed Nov 27, 2023
1 parent 27148ea commit 572006f
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions src/ui/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,33 +179,38 @@ export class Main extends React.Component<IProps, IState> {
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{' '}
<a href="#" onClick={() => invoke('open_in_browser', { url: latestVersion.link })}>
{latestVersion?.tag_name}
</a>{' '}
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{' '}
<a href="#" onClick={() => invoke('open_in_browser', { url: latestVersion.link })}>
{latestVersion?.tag_name}
</a>{' '}
is now available!
</>
),
})
}, 6000)

setTimeout(() => {
this.setState({
notification: null,
})
}, 6000)
}
}

// Period check to only show progress bar when downloading files
Expand Down

0 comments on commit 572006f

Please sign in to comment.