Fullscreen mode (#1968)

* Add preference to open app in full screen

* CLI flag for fullscreen and function to return fullscreen state

Parsing the config or the args to define how to open the app. Args take priority over the config, and fallback is the window state.

* Optional TS config value

Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>

* Remove undefined check for `Config.startInFullscreen`

* Fixed optional arg for test

* Fixed jest test

* fullscreen optional window value

* Update src/main/windows/mainWindow.ts

Co-authored-by: Guillermo Vayá <guivaya@gmail.com>

* Update src/main/windows/mainWindow.ts

Co-authored-by: Guillermo Vayá <guivaya@gmail.com>

* Type fixes

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
Co-authored-by: Guillermo Vayá <guivaya@gmail.com>
Co-authored-by: Devin Binnie <devin.binnie@mattermost.com>
This commit is contained in:
Colton Shaw
2022-03-28 17:22:08 -04:00
committed by GitHub
parent b7d9e771a2
commit 81cb2b6bed
12 changed files with 61 additions and 4 deletions

View File

@@ -68,8 +68,10 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
useSpellCheckerRef: React.RefObject<HTMLInputElement>;
spellCheckerURLRef: React.RefObject<HTMLInputElement>;
enableHardwareAccelerationRef: React.RefObject<HTMLInputElement>;
startInFullscreenRef: React.RefObject<HTMLInputElement>;
autoCheckForUpdatesRef: React.RefObject<HTMLInputElement>;
saveQueue: SaveQueueItem[];
selectedSpellCheckerLocales: Array<{label: string; value: string}>;
@@ -99,6 +101,7 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
this.showUnreadBadgeRef = React.createRef();
this.useSpellCheckerRef = React.createRef();
this.enableHardwareAccelerationRef = React.createRef();
this.startInFullscreenRef = React.createRef();
this.spellCheckerURLRef = React.createRef();
this.autoCheckForUpdatesRef = React.createRef();
@@ -326,6 +329,13 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
});
}
handleChangeStartInFullscreen = () => {
window.timers.setImmediate(this.saveSetting, CONFIG_TYPE_APP_OPTIONS, {key: 'startInFullscreen', data: this.startInFullscreenRef.current?.checked});
this.setState({
startInFullscreen: this.startInFullscreenRef.current?.checked,
});
}
saveDownloadLocation = (location: string) => {
if (!location) {
return;
@@ -747,6 +757,24 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
</FormCheck>,
);
options.push(
<FormCheck
key='inputStartInFullScreen'
>
<FormCheck.Input
type='checkbox'
id='inputStartInFullScreen'
ref={this.startInFullscreenRef}
checked={this.state.startInFullscreen}
onChange={this.handleChangeStartInFullscreen}
/>
{'Open app in fullscreen'}
<FormText>
{'If enabled, the Mattermost application will always open in full screen'}
</FormText>
</FormCheck>,
);
options.push(
<div
style={settingsPage.container}