mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feat] added auto update option on advance settings for windows (#773)
* [feat] added auto update option on advance settings for windows * minor fixes + translations * [feat] added popover for manual bsm update * [feat] added logic on update and restart * [feat] fixed sonar issues and added missing translations * Fix availve update and current app version were the same * Add a "See changelog" * Set autoupdate always enabled by default --------- Co-authored-by: Zagrios <40181755+Zagrios@users.noreply.github.com>
This commit is contained in:
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "veraltet"
|
||||
"outdated": "veraltet",
|
||||
"update-text": "BSManager {version} ist verfügbar!",
|
||||
"update-button": "Aktualisieren und neu starten",
|
||||
"see-changelog": "Änderungen ansehen"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Version hinzufügen",
|
||||
@@ -337,6 +340,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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "outdated"
|
||||
"outdated": "outdated",
|
||||
"update-text": "BSManager {version} is available!",
|
||||
"update-button": "Update and Restart",
|
||||
"see-changelog": "See changelog"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Add a version",
|
||||
@@ -337,6 +340,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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "obsoleto"
|
||||
"outdated": "obsoleto",
|
||||
"update-text": "¡BSManager {version} está disponible!",
|
||||
"update-button": "Actualizar y reiniciar",
|
||||
"see-changelog": "Ver los cambios"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Agregar una versión",
|
||||
@@ -337,6 +340,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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "obsolète"
|
||||
"outdated": "obsolète",
|
||||
"update-text": "BSManager {version} est disponible!",
|
||||
"update-button": "Mettre à jour et redémarrer",
|
||||
"see-changelog": "Voir les changements"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Ajouter une version",
|
||||
@@ -337,6 +340,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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "obsoleta"
|
||||
"outdated": "obsoleta",
|
||||
"update-text": "BSManager {version} è disponibile!",
|
||||
"update-button": "Aggiorna e riavvia",
|
||||
"see-changelog": "Vedi i cambiamenti"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Aggiungi una versione",
|
||||
@@ -337,6 +340,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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "時代遅れ"
|
||||
"outdated": "時代遅れ",
|
||||
"update-text": "BSManager {version} が利用可能です!",
|
||||
"update-button": "更新して再起動",
|
||||
"see-changelog": "変更点を確認"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "バージョンを追加",
|
||||
@@ -337,6 +340,13 @@
|
||||
"error-notification": {
|
||||
"message": "エラーが発生しました。システムプロキシ設定を変更できません。"
|
||||
}
|
||||
},
|
||||
"auto-update": {
|
||||
"title": "自動更新",
|
||||
"description": "アプリケーション起動時にBSManagerが自動的に更新されます。",
|
||||
"error-notification": {
|
||||
"message": "エラーが発生し、自動更新の設定を変更できませんでした。"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "구식"
|
||||
"outdated": "구식",
|
||||
"update-text": "BSManager {version} 가 사용 가능합니다!",
|
||||
"update-button": "업데이트 후 재시작",
|
||||
"see-changelog": "변경 사항 보기"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "버전 추가",
|
||||
@@ -337,6 +340,13 @@
|
||||
"error-notification": {
|
||||
"message": "오류가 발생했습니다. 시스템 프록시 설정을 변경할 수 없습니다."
|
||||
}
|
||||
},
|
||||
"auto-update": {
|
||||
"title": "자동 업데이트",
|
||||
"description": "애플리케이션을 실행할 때 BSManager가 자동으로 업데이트됩니다.",
|
||||
"error-notification": {
|
||||
"message": "오류가 발생하여 자동 업데이트 설정을 변경할 수 없습니다."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "Desatualizado"
|
||||
"outdated": "Desatualizado",
|
||||
"update-text": "BSManager {version} está disponível!",
|
||||
"update-button": "Atualizar e reiniciar",
|
||||
"see-changelog": "Ver os changelogs"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Adicionar uma versão",
|
||||
@@ -337,6 +340,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."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "устаревший"
|
||||
"outdated": "устаревший",
|
||||
"update-text": "BSManager {version} доступен!",
|
||||
"update-button": "Обновить и перезапустить",
|
||||
"see-changelog": "Смотреть изменения"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Добавить версию игры",
|
||||
@@ -337,6 +340,13 @@
|
||||
"error-notification": {
|
||||
"message": "Произошла ошибка, не удалось изменить настройки системного прокси."
|
||||
}
|
||||
},
|
||||
"auto-update": {
|
||||
"title": "Автообновление",
|
||||
"description": "BSManager будет автоматически обновляться при запуске приложения.",
|
||||
"error-notification": {
|
||||
"message": "Произошла ошибка, не удалось изменить настройки автообновления."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "lipas na"
|
||||
"outdated": "lipas na",
|
||||
"update-text": "Ang BSManager {version} ay available!",
|
||||
"update-button": "I-update at i-restart",
|
||||
"see-changelog": "Tingnan ang mga pagbabago"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Magdagdag ng bersyon",
|
||||
@@ -337,6 +340,13 @@
|
||||
"error-notification": {
|
||||
"message": "Nagkaroon ng error, hindi ma-bago ang setting ng system proxy."
|
||||
}
|
||||
},
|
||||
"auto-update": {
|
||||
"title": "Awtomatikong Pag-update",
|
||||
"description": "Ang BSManager ay awtomatikong mag-uupdate kapag binuksan mo ang aplikasyon.",
|
||||
"error-notification": {
|
||||
"message": "Nagkaroon ng error, hindi mababago ang mga setting ng awtomatikong pag-update."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "застарілий"
|
||||
"outdated": "застарілий",
|
||||
"update-text": "BSManager {version} доступний!",
|
||||
"update-button": "Оновити та перезапустити",
|
||||
"see-changelog": "Переглянути зміни"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "Додати версію",
|
||||
@@ -337,6 +340,13 @@
|
||||
"error-notification": {
|
||||
"message": "Сталася помилка, неможливо змінити налаштування системного проксі."
|
||||
}
|
||||
},
|
||||
"auto-update": {
|
||||
"title": "Автоматичне оновлення (Avtomatychne onovlennya)",
|
||||
"description": "BSManager автоматично оновлюватиметься, коли ви запустите програму.",
|
||||
"error-notification": {
|
||||
"message": "Сталася помилка, неможливо змінити налаштування автоматичного оновлення."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "過時"
|
||||
"outdated": "過時",
|
||||
"update-text": "BSManager {version} 可用!",
|
||||
"update-button": "更新並重新啟動",
|
||||
"see-changelog": "查看變更"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "新增版本",
|
||||
@@ -337,6 +340,13 @@
|
||||
"error-notification": {
|
||||
"message": "發生錯誤,無法更改系統代理設置。"
|
||||
}
|
||||
},
|
||||
"auto-update": {
|
||||
"title": "自動更新",
|
||||
"description": "啟動應用程式時,BSManager 將自動更新。",
|
||||
"error-notification": {
|
||||
"message": "發生錯誤,無法更改自動更新設定。"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
}
|
||||
},
|
||||
"title-bar": {
|
||||
"outdated": "过时"
|
||||
"outdated": "过时",
|
||||
"update-text": "BSManager {version} 可用!",
|
||||
"update-button": "更新并重新启动",
|
||||
"see-changelog": "查看变更"
|
||||
},
|
||||
"nav-bar": {
|
||||
"add-version": "添加版本",
|
||||
@@ -337,6 +340,13 @@
|
||||
"error-notification": {
|
||||
"message": "发生错误,无法启用系统代理。"
|
||||
}
|
||||
},
|
||||
"auto-update": {
|
||||
"title": "自动更新",
|
||||
"description": "启动应用程序时,BSManager 将自动更新。",
|
||||
"error-notification": {
|
||||
"message": "发生错误,无法更改自动更新设置。"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,11 @@ ipc.on("check-update", (_, reply) => {
|
||||
reply(from(updaterService.isUpdateAvailable()));
|
||||
});
|
||||
|
||||
ipc.on("get-available-update", (_, reply) => {
|
||||
const updaterService = AutoUpdaterService.getInstance();
|
||||
reply(from(updaterService.getAvailableUpdate()));
|
||||
});
|
||||
|
||||
ipc.on("install-update", (_, reply) => {
|
||||
const updaterService = AutoUpdaterService.getInstance();
|
||||
reply(of(updaterService.quitAndInstall()));
|
||||
|
||||
+12
-5
@@ -28,6 +28,7 @@ import { StaticConfigurationService } from "./services/static-configuration.serv
|
||||
import { configureProxy } from './helpers/proxy.helpers';
|
||||
import { deleteFileSync, deleteFolderSync } from "./helpers/fs.helpers";
|
||||
import { tryit } from "shared/helpers/error.helpers";
|
||||
import { AutoUpdate } from "shared/models/config";
|
||||
|
||||
const isDebug = process.env.NODE_ENV === "development" || process.env.DEBUG_PROD === "true";
|
||||
const staticConfig = StaticConfigurationService.getInstance();
|
||||
@@ -121,8 +122,6 @@ if (!gotTheLock) {
|
||||
|
||||
app.whenReady().then(() => {
|
||||
|
||||
|
||||
|
||||
app.setAppUserModelId(APP_NAME);
|
||||
|
||||
initServicesMustBeInitialized();
|
||||
@@ -134,10 +133,18 @@ 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 configService = StaticConfigurationService.getInstance();
|
||||
const autoUpdate = configService.get("auto-update", AutoUpdate.ALWAYS);
|
||||
const update = autoUpdate !== AutoUpdate.NEVER;
|
||||
if (autoUpdate === AutoUpdate.ONCE) {
|
||||
configService.set("auto-update", AutoUpdate.NEVER);
|
||||
}
|
||||
|
||||
// Skip launcher only if autoUpdate is strictly false
|
||||
createWindow(update ? "launcher.html" : "index.html");
|
||||
}
|
||||
|
||||
SteamLauncherService.getInstance().restoreSteamVR();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { autoUpdater, CancellationToken, ProgressInfo } from "electron-updater";
|
||||
import { autoUpdater, CancellationToken, ProgressInfo, UpdateInfo } from "electron-updater";
|
||||
import log from "electron-log";
|
||||
import { gt } from "semver";
|
||||
import { Progression } from "main/helpers/fs.helpers";
|
||||
import { Observable } from "rxjs";
|
||||
import { safeGt } from "shared/helpers/semver.helpers";
|
||||
|
||||
export class AutoUpdaterService {
|
||||
private static instance: AutoUpdaterService;
|
||||
@@ -31,6 +32,18 @@ export class AutoUpdaterService {
|
||||
});
|
||||
}
|
||||
|
||||
public async getAvailableUpdate(): Promise<UpdateInfo | null> {
|
||||
return autoUpdater.checkForUpdates().then(info => {
|
||||
if (info?.updateInfo && safeGt(info.updateInfo.version, autoUpdater.currentVersion.version)) {
|
||||
return info.updateInfo;
|
||||
}
|
||||
return null;
|
||||
}).catch((error: Error): UpdateInfo | null => {
|
||||
log.error("Could not get update", error);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
public downloadUpdate(): Observable<Progression> {
|
||||
return new Observable<Progression>(observer => {
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { PROTON_BINARY_PREFIX, WINE_BINARY_PREFIX } from "main/constants";
|
||||
import { Observable, Subject } from "rxjs";
|
||||
import { CustomError } from "shared/models/exceptions/custom-error.class";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { AutoUpdate } from "shared/models/config";
|
||||
|
||||
export class StaticConfigurationService {
|
||||
private static instance: StaticConfigurationService;
|
||||
@@ -30,8 +31,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 {
|
||||
@@ -90,6 +91,7 @@ export interface StaticConfigKeyValues {
|
||||
"use-symlinks": boolean;
|
||||
"use-system-proxy": boolean;
|
||||
"last-version-launched": BSVersion;
|
||||
"auto-update": AutoUpdate;
|
||||
|
||||
// Linux Specific static configs
|
||||
"proton-folder": string;
|
||||
|
||||
@@ -12,36 +12,47 @@ import { useService } from "renderer/hooks/use-service.hook";
|
||||
import { lastValueFrom } from "rxjs";
|
||||
import { useWindowControls } from "renderer/hooks/use-window-controls.hook";
|
||||
import { useTranslationV2 } from "renderer/hooks/use-translation.hook";
|
||||
import Tippy from "@tippyjs/react";
|
||||
import { StaticConfigurationService } from "renderer/services/static-configuration.service";
|
||||
import { AutoUpdate } from "shared/models/config";
|
||||
import { UpdateInfo } from "electron-updater";
|
||||
|
||||
function TitleBarTags() {
|
||||
function useVersion() {
|
||||
const ipcService = useService(IpcService);
|
||||
const t = useTranslationV2();
|
||||
|
||||
const [previewVersion, setPreviewVersion] = useState("");
|
||||
const [outdated, setOutdated] = useState(false);
|
||||
const [currentVersion, setCurrentVersion] = useState("");
|
||||
const [latestVersion, setLatestVersion] = useState<UpdateInfo | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const requests: Promise<any>[] = [
|
||||
lastValueFrom(ipcService.sendV2("current-version"))
|
||||
];
|
||||
if (window.electron.platform === "linux") {
|
||||
requests.push(lastValueFrom(ipcService.sendV2("check-update")));
|
||||
}
|
||||
|
||||
Promise.all(requests).then(([ currentVersion, outdated ]) => {
|
||||
handlePrerelease(currentVersion);
|
||||
setOutdated(outdated);
|
||||
Promise.all([
|
||||
lastValueFrom(ipcService.sendV2("current-version")),
|
||||
lastValueFrom(ipcService.sendV2("get-available-update"))
|
||||
]).then(([ currentVersion, latestVersion ]) => {
|
||||
setCurrentVersion(currentVersion);
|
||||
setLatestVersion(latestVersion);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handlePrerelease = (version: string) => {
|
||||
return { currentVersion, latestVersion };
|
||||
}
|
||||
|
||||
function TitleBarTags({ version, latestVersion }: Readonly<{
|
||||
version: string;
|
||||
latestVersion: UpdateInfo | null;
|
||||
}>) {
|
||||
const t = useTranslationV2();
|
||||
|
||||
const previewVersion = (() => {
|
||||
if (version.toLowerCase().includes("alpha")) {
|
||||
return setPreviewVersion("ALPHA");
|
||||
return "ALPHA";
|
||||
}
|
||||
|
||||
if (version.toLowerCase().includes("beta")) {
|
||||
return setPreviewVersion("BETA");
|
||||
return "BETA";
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
})();
|
||||
|
||||
return <>
|
||||
{previewVersion &&
|
||||
@@ -49,7 +60,7 @@ function TitleBarTags() {
|
||||
{previewVersion}
|
||||
</span>
|
||||
}
|
||||
{outdated &&
|
||||
{latestVersion &&
|
||||
<span className="bg-warning-500 text-black rounded-full ml-1 text-[10px] italic px-1 uppercase h-3.5 font-bold">
|
||||
{t.text("title-bar.outdated")}
|
||||
</span>
|
||||
@@ -57,12 +68,65 @@ function TitleBarTags() {
|
||||
</>;
|
||||
}
|
||||
|
||||
function AutoUpdateButton({ latestVersion }: Readonly<{
|
||||
latestVersion: UpdateInfo | null;
|
||||
}>) {
|
||||
const configService = useService(StaticConfigurationService);
|
||||
const ipcService = useService(IpcService);
|
||||
const { text: t } = useTranslationV2();
|
||||
|
||||
const isLinux = window.electron.platform === "linux";
|
||||
|
||||
const updateAndRestart = async () => {
|
||||
await configService.set("auto-update", AutoUpdate.ONCE);
|
||||
await lastValueFrom(ipcService.sendV2("restart-app"));
|
||||
};
|
||||
|
||||
|
||||
const renderTippyContent = () => {
|
||||
return (
|
||||
<div className="p-2">
|
||||
<div>{t("title-bar.update-text", { version: latestVersion.version })}</div>
|
||||
{latestVersion?.version ? (
|
||||
<a href={`https://github.com/Zagrios/bs-manager/releases/tag/v${latestVersion.version}`} target="_blank" className="cursor-pointer underline text-sm hover:text-gray-300">{t("title-bar.see-changelog")}</a>
|
||||
) : null}
|
||||
{!isLinux &&
|
||||
<BsmButton typeColor="primary"
|
||||
className="text-center rounded-md px-2 py-1 mt-2"
|
||||
text={t("title-bar.update-button")}
|
||||
withBar={false}
|
||||
onClick={() => updateAndRestart()}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return latestVersion && (
|
||||
<Tippy
|
||||
zIndex={1000}
|
||||
placement="bottom"
|
||||
content={renderTippyContent()}
|
||||
theme="default"
|
||||
hideOnClick
|
||||
interactive
|
||||
>
|
||||
<BsmButton
|
||||
className="shrink-0 w-11 h-full aspect-square !bg-transparent flex items-start p-0.5"
|
||||
icon="download"
|
||||
withBar={false}
|
||||
/>
|
||||
</Tippy>
|
||||
);
|
||||
}
|
||||
|
||||
export default function TitleBar({ template = "index.html" }: { template: AppWindow }) {
|
||||
const audio = useService(AudioPlayerService);
|
||||
const windowControls = useWindowControls();
|
||||
|
||||
const volume = useObservable(() => audio.volume$, audio.volume);
|
||||
const color = useThemeColor("first-color");
|
||||
const { currentVersion, latestVersion } = useVersion();
|
||||
|
||||
const [maximized, setMaximized] = useState(false);
|
||||
|
||||
@@ -107,7 +171,7 @@ export default function TitleBar({ template = "index.html" }: { template: AppWin
|
||||
<div id="drag-region" className="grow basis-0 h-full">
|
||||
<div id="window-title" className="pl-1">
|
||||
<span className="text-gray-800 dark:text-gray-100 font-bold text-xs italic">BSManager</span>
|
||||
<TitleBarTags />
|
||||
<TitleBarTags version={currentVersion} latestVersion={latestVersion} />
|
||||
</div>
|
||||
</div>
|
||||
<div id="window-controls" className="h-full flex shrink-0 items-center">
|
||||
@@ -117,6 +181,7 @@ export default function TitleBar({ template = "index.html" }: { template: AppWin
|
||||
</div>
|
||||
<BsmButton className="shrink-0 h-[23px] w-[23px] aspect-square !bg-transparent flex items-start" iconClassName={volumeIcon === "volume-down" ? "-translate-x-[1.8px]" : null} icon={volumeIcon} withBar={false} onClick={() => audio.toggleMute()} />
|
||||
</div>
|
||||
<AutoUpdateButton latestVersion={latestVersion} />
|
||||
<button onClick={minimizeWindow} className="text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-[#4F545C] cursor-pointer w-11 h-full shrink-0 flex justify-center items-center" id="min-button">
|
||||
<svg aria-hidden="false" width="12" height="12" viewBox="0 0 12 12">
|
||||
<rect fill="currentColor" width="10" height="1" x="1" y="6" />
|
||||
|
||||
@@ -48,6 +48,7 @@ import { InstallationLocationService } from "renderer/services/installation-loca
|
||||
import { AutoUpdaterService } from "renderer/services/auto-updater.service";
|
||||
import { OculusDownloaderService } from "renderer/services/bs-version-download/oculus-downloader.service";
|
||||
import { DISCORD_URL } from "shared/constants";
|
||||
import { AutoUpdate } from "shared/models/config";
|
||||
|
||||
export function SettingsPage() {
|
||||
|
||||
@@ -546,11 +547,17 @@ function AdvancedSettings() {
|
||||
const [hardwareAccelerationEnabled, setHardwareAccelerationEnabled] = useState(true);
|
||||
const [useSymlink, setUseSymlink] = useState(false);
|
||||
const [useSystemProxy, setUseSystemProxy] = useState(false);
|
||||
const [autoUpdate, setAutoUpdate] = useState<AutoUpdate>(AutoUpdate.NEVER);
|
||||
|
||||
|
||||
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(res => setAutoUpdate(() => res ?? AutoUpdate.ALWAYS));
|
||||
}
|
||||
}, []);
|
||||
|
||||
const onChangeHardwareAcceleration = async (newHardwareAccelerationEnabled: boolean) => {
|
||||
@@ -631,12 +638,43 @@ function AdvancedSettings() {
|
||||
setUseSystemProxy(() => newUseSystemProxy);
|
||||
}
|
||||
|
||||
const advancedItems: Item[] = [{
|
||||
const onChangeAutoUpdate = async (value: boolean) => {
|
||||
if (window.electron.platform !== "win32") {
|
||||
return;
|
||||
}
|
||||
|
||||
const newAutoUpdate = value ? AutoUpdate.ALWAYS : AutoUpdate.NEVER;
|
||||
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 === AutoUpdate.ALWAYS,
|
||||
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,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
export enum AutoUpdate {
|
||||
ALWAYS = "always",
|
||||
// When "Update and restart" is clicked
|
||||
ONCE = "once",
|
||||
NEVER = "never",
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import { LocalBPList, LocalBPListsDetails } from "../playlists/local-playlist.mo
|
||||
import { StaticConfigGetIpcRequestResponse, StaticConfigKeys, StaticConfigSetIpcRequest } from "main/services/static-configuration.service";
|
||||
import { BbmFullMod, BbmModVersion, ExternalMod } from "../mods/mod.interface";
|
||||
import { OculusDownloadInfo } from "main/services/bs-version-download/bs-oculus-downloader.service";
|
||||
import { UpdateInfo } from "electron-updater";
|
||||
|
||||
export type IpcReplier<T> = (data: Observable<T>) => void;
|
||||
|
||||
@@ -122,6 +123,7 @@ export interface IpcChannelMapping {
|
||||
/* ** launcher-ipcs ** */
|
||||
"download-update": { request: void, response: Progression };
|
||||
"check-update": { request: void, response: boolean };
|
||||
"get-available-update": { request: void, response: UpdateInfo | null };
|
||||
"install-update": { request: void, response: void };
|
||||
|
||||
/* ** model-saber.ipcs ** */
|
||||
|
||||
Reference in New Issue
Block a user