diff --git a/assets/jsons/translations/en.json b/assets/jsons/translations/en.json index 3054223e..10489b26 100644 --- a/assets/jsons/translations/en.json +++ b/assets/jsons/translations/en.json @@ -319,6 +319,13 @@ "error-notification": { "message": "An error occurred, unable to change system proxy settings." } + }, + "auto-update": { + "title": "Auto Update", + "description": "BSManager will automatically update when you launch the application.", + "error-notification": { + "message": "An error occurred, unable to change auto update settings." + } } } } diff --git a/src/main/main.ts b/src/main/main.ts index ab12b37c..82d04bd2 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -119,8 +119,6 @@ if (!gotTheLock) { app.whenReady().then(() => { - - app.setAppUserModelId(APP_NAME); initServicesMustBeInitialized(); @@ -132,10 +130,12 @@ if (!gotTheLock) { DeepLinkService.getInstance().dispatchLinkOpened(deepLink); } else if (associatedFile) { FileAssociationService.getInstance().handleFileAssociation(associatedFile); + } else if (process.platform === "linux") { + createWindow("index.html"); } else { - createWindow(process.platform === "linux" - ? "index.html" : "launcher.html" - ); + const autoUpdate = StaticConfigurationService.getInstance().get("auto-update"); + createWindow(autoUpdate === undefined || autoUpdate === true + ? "launcher.html" : "index.html"); } SteamLauncherService.getInstance().restoreSteamVR(); diff --git a/src/main/services/static-configuration.service.ts b/src/main/services/static-configuration.service.ts index 47e99245..cbc1f23c 100644 --- a/src/main/services/static-configuration.service.ts +++ b/src/main/services/static-configuration.service.ts @@ -30,8 +30,8 @@ export class StaticConfigurationService { return this.store.has(key); } - public get(key: K): StaticConfigKeyValues[K] { - return this.store.get(key) as StaticConfigKeyValues[K]; + public get(key: K, defaultValue?: StaticConfigKeyValues[K]): StaticConfigKeyValues[K] { + return this.store.get(key, defaultValue) as StaticConfigKeyValues[K]; } public take(key: K, cb: (val: StaticConfigKeyValues[K]) => void): void { @@ -90,6 +90,7 @@ export interface StaticConfigKeyValues { "use-symlinks": boolean; "use-system-proxy": boolean; "last-version-launched": BSVersion; + "auto-update": boolean; // Linux Specific static configs "proton-folder": string; diff --git a/src/renderer/pages/settings-page.component.tsx b/src/renderer/pages/settings-page.component.tsx index 1501162d..257a0e7e 100644 --- a/src/renderer/pages/settings-page.component.tsx +++ b/src/renderer/pages/settings-page.component.tsx @@ -545,11 +545,17 @@ function AdvancedSettings() { const [hardwareAccelerationEnabled, setHardwareAccelerationEnabled] = useState(true); const [useSymlink, setUseSymlink] = useState(false); const [useSystemProxy, setUseSystemProxy] = useState(false); + const [autoUpdate, setAutoUpdate] = useState(true); + useEffect(() => { staticConfig.get("disable-hadware-acceleration").then(disabled =>setHardwareAccelerationEnabled(() => disabled !== true)); - staticConfig.get("use-symlinks").then(useSymlinks => setUseSymlink(() => useSymlinks)); - staticConfig.get("use-system-proxy").then(useSystemProxy => setUseSystemProxy(() => useSystemProxy)); + + if (window.electron.platform === "win32") { + staticConfig.get("use-symlinks").then(useSymlinks => setUseSymlink(() => useSymlinks)); + staticConfig.get("use-system-proxy").then(useSystemProxy => setUseSystemProxy(() => useSystemProxy)); + staticConfig.get("auto-update").then(value => setAutoUpdate(() => value)); + } }, []); const onChangeHardwareAcceleration = async (newHardwareAccelerationEnabled: boolean) => { @@ -630,12 +636,38 @@ function AdvancedSettings() { setUseSystemProxy(() => newUseSystemProxy); } - const advancedItems: Item[] = [{ + const onChangeAutoUpdate = async (newAutoUpdate: boolean) => { + if (window.electron.platform !== "win32") { + return; + } + + const { error } = await tryit(() => staticConfig.set("auto-update", newAutoUpdate)); + if (error) { + notification.notifyError({ + title: "notifications.types.error", + desc: "pages.settings.advanced.auto-update.error-notification.message", + }); + } + } + + const advancedItems: Item[] = []; + + if (window.electron.platform === "win32") { + advancedItems.push({ + checked: autoUpdate, + text: t.text("pages.settings.advanced.auto-update.title"), + desc: t.text("pages.settings.advanced.auto-update.description"), + onChange: onChangeAutoUpdate + }); + } + + advancedItems.push({ checked: hardwareAccelerationEnabled, text: t.text("pages.settings.advanced.hardware-acceleration.title"), desc: t.text("pages.settings.advanced.hardware-acceleration.description"), onChange: onChangeHardwareAcceleration - }]; + }); + if (window.electron.platform === "win32") { advancedItems.push({ checked: useSymlink,