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

[feat] added auto update option on advance settings for windows #773

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions assets/jsons/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@
"error-notification": {
"message": "Es ist ein Fehler aufgetreten, die Systemproxyeinstellungen können nicht geändert werden."
}
},
"auto-update": {
"title": "Automatische Aktualisierung",
"description": "BSManager wird beim Start der Anwendung automatisch aktualisiert.",
"error-notification": {
"message": "Ein Fehler ist aufgetreten, die Einstellungen für die automatische Aktualisierung können nicht geändert werden."
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@
"error-notification": {
"message": "Ocurrió un error, no se pueden cambiar los ajustes del proxy del sistema."
}
},
"auto-update": {
"title": "Actualización automática",
"description": "BSManager se actualizará automáticamente al iniciar la aplicación.",
"error-notification": {
"message": "Ocurrió un error, no se pudo cambiar la configuración de actualización automática."
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@
"error-notification": {
"message": "Une erreur est survenue, impossible de modifier les paramètres du proxy système."
}
},
"auto-update": {
"title": "Mise à jour automatique",
"description": "BSManager se mettra automatiquement à jour au lancement de l'application.",
"error-notification": {
"message": "Une erreur est survenue, impossible de modifier les paramètres de mise à jour automatique."
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@
"error-notification": {
"message": "C'è stato un errore, impossibile cambiare le impostazioni del proxy di sistema."
}
},
"auto-update": {
"title": "Aggiornamento automatico",
"description": "BSManager si aggiornerà automaticamente all'avvio dell'applicazione.",
"error-notification": {
"message": "Si è verificato un errore, impossibile modificare le impostazioni di aggiornamento automatico."
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@
"error-notification": {
"message": "エラーが発生しました。システムプロキシ設定を変更できません。"
}
},
"auto-update": {
"title": "自動更新",
"description": "アプリケーション起動時にBSManagerが自動的に更新されます。",
"error-notification": {
"message": "エラーが発生し、自動更新の設定を変更できませんでした。"
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@
"error-notification": {
"message": "오류가 발생했습니다. 시스템 프록시 설정을 변경할 수 없습니다."
}
},
"auto-update": {
"title": "자동 업데이트",
"description": "애플리케이션을 실행할 때 BSManager가 자동으로 업데이트됩니다.",
"error-notification": {
"message": "오류가 발생하여 자동 업데이트 설정을 변경할 수 없습니다."
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@
"error-notification": {
"message": "Um erro aconteceu, não foi possível alterar a configuração de proxy de sistema."
}
},
"auto-update": {
"title": "Atualização automática",
"description": "O BSManager será atualizado automaticamente ao iniciar o aplicativo.",
"error-notification": {
"message": "Ocorreu um erro, não foi possível alterar as configurações de atualização automática."
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@
"error-notification": {
"message": "Произошла ошибка, не удалось изменить настройки системного прокси."
}
},
"auto-update": {
"title": "Автообновление",
"description": "BSManager будет автоматически обновляться при запуске приложения.",
"error-notification": {
"message": "Произошла ошибка, не удалось изменить настройки автообновления."
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@
"error-notification": {
"message": "發生錯誤,無法更改系統代理設置。"
}
},
"auto-update": {
"title": "自動更新",
"description": "啟動應用程式時,BSManager 將自動更新。",
"error-notification": {
"message": "發生錯誤,無法更改自動更新設定。"
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions assets/jsons/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,13 @@
"error-notification": {
"message": "发生错误,无法启用系统代理。"
}
},
"auto-update": {
"title": "自动更新",
"description": "启动应用程序时,BSManager 将自动更新。",
"error-notification": {
"message": "发生错误,无法更改自动更新设置。"
}
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ if (!gotTheLock) {

app.whenReady().then(() => {



app.setAppUserModelId(APP_NAME);

initServicesMustBeInitialized();
Expand All @@ -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", true);
// Skip launcher only if autoUpdate is strictly false
createWindow(autoUpdate !== false ? "launcher.html" : "index.html");
}

SteamLauncherService.getInstance().restoreSteamVR();
Expand Down
5 changes: 3 additions & 2 deletions src/main/services/static-configuration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class StaticConfigurationService {
return this.store.has(key);
}

public get<K extends StaticConfigKeys>(key: K): StaticConfigKeyValues[K] {
return this.store.get<K>(key) as StaticConfigKeyValues[K];
public get<K extends StaticConfigKeys>(key: K, defaultValue?: StaticConfigKeyValues[K]): StaticConfigKeyValues[K] {
return this.store.get<K>(key, defaultValue) as StaticConfigKeyValues[K];
}

public take<K extends StaticConfigKeys>(key: K, cb: (val: StaticConfigKeyValues[K]) => void): void {
Expand Down Expand Up @@ -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;
Expand Down
43 changes: 39 additions & 4 deletions src/renderer/pages/settings-page.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== false));
}
}, []);

const onChangeHardwareAcceleration = async (newHardwareAccelerationEnabled: boolean) => {
Expand Down Expand Up @@ -630,12 +636,41 @@ 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",
});
return;
}

setAutoUpdate(() => newAutoUpdate);
}

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,
Expand Down
Loading