Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes #217

Merged
merged 4 commits into from
Dec 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/ui/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface IState {
notification: React.ReactElement | null
isGamePathSet: boolean
game_install_path: string
platform: string
}

export class Main extends React.Component<IProps, IState> {
Expand All @@ -64,6 +65,7 @@ export class Main extends React.Component<IProps, IState> {
notification: null,
isGamePathSet: true,
game_install_path: '',
platform: '',
}

listen('lang_error', (payload) => {
Expand Down Expand Up @@ -152,10 +154,18 @@ export class Main extends React.Component<IProps, IState> {
game_install_path: game_path,
})

if (this.state.game_install_path === '') {
this.setState({ isGamePathSet: false })
}

this.setState({
migotoSet: !!(await getConfigOption('migoto_path')),
})

this.setState({
platform: await invoke('get_platform'),
})

if (!cert_generated) {
// Generate the certificate
await invoke('generate_ca_files', {
Expand All @@ -169,6 +179,9 @@ export class Main extends React.Component<IProps, IState> {
const updatedConfig = await getConfigOption('patch_rsa')
await setConfigOption('patch_rsa', updatedConfig)

// Update launch args to allow launching when updating from old versions
await setConfigOption('launch_args', await getConfigOption('launch_args'))

// Get latest version and compare to this version
const latestVersion: {
tag_name: string
Expand Down Expand Up @@ -222,7 +235,7 @@ export class Main extends React.Component<IProps, IState> {
})) 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', '')
}

Expand Down Expand Up @@ -323,7 +336,10 @@ export class Main extends React.Component<IProps, IState> {
this.state.optionsOpen ? (
<Options
downloadManager={this.props.downloadHandler}
closeFn={() => this.setState({ optionsOpen: !this.state.optionsOpen })}
closeFn={async () => {
this.setState({ optionsOpen: !this.state.optionsOpen })
this.setState({ migotoSet: !!(await getConfigOption('migoto_path')) })
}}
/>
) : null
}
Expand Down
Loading