add hide on start option (#1919)

* add hide on start option (#1918)

* text update

* clean up

* removed `hideOnStart` from ConfigV1 & ConfigV2

* tests update
This commit is contained in:
Profesor08
2021-12-13 16:19:59 +02:00
committed by GitHub
parent fca6a75ee4
commit a410222e14
9 changed files with 55 additions and 3 deletions

View File

@@ -58,6 +58,7 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
downloadLocationRef: React.RefObject<HTMLInputElement>;
showTrayIconRef: React.RefObject<HTMLInputElement>;
autostartRef: React.RefObject<HTMLInputElement>;
hideOnStartRef: React.RefObject<HTMLInputElement>;
minimizeToTrayRef: React.RefObject<HTMLInputElement>;
flashWindowRef: React.RefObject<HTMLInputElement>;
bounceIconRef: React.RefObject<HTMLInputElement>;
@@ -88,6 +89,7 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
this.downloadLocationRef = React.createRef();
this.showTrayIconRef = React.createRef();
this.autostartRef = React.createRef();
this.hideOnStartRef = React.createRef();
this.minimizeToTrayRef = React.createRef();
this.flashWindowRef = React.createRef();
this.bounceIconRef = React.createRef();
@@ -204,6 +206,13 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
});
}
handleChangeHideOnStart = () => {
window.timers.setImmediate(this.saveSetting, CONFIG_TYPE_APP_OPTIONS, {key: 'hideOnStart', data: this.hideOnStartRef.current?.checked});
this.setState({
hideOnStart: this.hideOnStartRef.current?.checked,
});
}
handleChangeMinimizeToTray = () => {
const shouldMinimizeToTray = this.state.showTrayIcon && this.minimizeToTrayRef.current?.checked;
@@ -419,6 +428,22 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
{'If enabled, the app starts automatically when you log in to your machine.'}
</FormText>
</FormCheck>);
options.push(
<FormCheck>
<FormCheck.Input
type='checkbox'
key='inputHideOnStart'
id='inputHideOnStart'
ref={this.hideOnStartRef}
checked={this.state.hideOnStart}
onChange={this.handleChangeHideOnStart}
/>
{'Launch app minimized'}
<FormText>
{'If enabled, the app will start in system tray, and will not show the window on launch.'}
</FormText>
</FormCheck>);
}
options.push(