mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[bugfix-821] Add error messages for Beat Saber uninstallation
This commit is contained in:
@@ -16,6 +16,7 @@ import equal from "fast-deep-equal";
|
||||
import { useOnUpdate } from "renderer/hooks/use-on-update.hook";
|
||||
import { BsDownloaderService } from "renderer/services/bs-version-download/bs-downloader.service";
|
||||
import { ProgressBarService } from "renderer/services/progress-bar.service";
|
||||
import { noop } from "shared/helpers/function.helpers";
|
||||
|
||||
export function BsVersionItem(props: { version: BSVersion }) {
|
||||
|
||||
@@ -70,7 +71,7 @@ export function BsVersionItem(props: { version: BSVersion }) {
|
||||
const wasVerification = bsDownloader.isVerifying;
|
||||
bsDownloader.stopDownload().then(() => {
|
||||
if(wasVerification){ return; }
|
||||
bsUninstallerService.uninstall(versionDownload).then(res => res && verionManagerService.askInstalledVersions());
|
||||
bsUninstallerService.uninstall(versionDownload).then(() => verionManagerService.askInstalledVersions()).catch(noop);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import { logRenderError } from "renderer";
|
||||
import { BsModsManagerService } from "renderer/services/bs-mods-manager.service";
|
||||
import { noop } from "shared/helpers/function.helpers";
|
||||
import { useTranslationV2 } from "renderer/hooks/use-translation.hook";
|
||||
import { CustomError } from "shared/models/exceptions/custom-error.class";
|
||||
|
||||
export function VersionViewer() {
|
||||
|
||||
@@ -125,13 +126,25 @@ export function VersionViewer() {
|
||||
|
||||
const uninstall = async () => {
|
||||
const modalCompleted = await modalService.openModal(UninstallModal, { data: state });
|
||||
if (modalCompleted.exitCode === ModalExitCode.COMPLETED) {
|
||||
bsUninstallerService.uninstall(state).then(() => {
|
||||
bsVersionManagerService.askInstalledVersions().then(versions => {
|
||||
navigateToVersion(versions?.at(0));
|
||||
});
|
||||
});
|
||||
if (modalCompleted.exitCode !== ModalExitCode.COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
bsUninstallerService.uninstall(state).then(() => {
|
||||
bsVersionManagerService.askInstalledVersions().then(versions => {
|
||||
navigateToVersion(versions?.at(0));
|
||||
});
|
||||
}).catch((err: CustomError) => {
|
||||
let desc = err?.message;
|
||||
|
||||
if (["CantDeleteOfficialVersion", "VersionNotFound"].includes(err?.code)) {
|
||||
desc = `notifications.bs-uninstall.errors.desc.${err.code}`;
|
||||
} else if (err?.code?.startsWith("generic.fs.delete-folder")) {
|
||||
desc = "notifications.bs-uninstall.errors.desc.delete-folder";
|
||||
}
|
||||
|
||||
notification.notifyError({ title: "notifications.bs-uninstall.errors.title", desc });
|
||||
});
|
||||
};
|
||||
|
||||
const edit = () => {
|
||||
|
||||
@@ -18,7 +18,7 @@ export class BSUninstallerService {
|
||||
this.ipcService = IpcService.getInstance();
|
||||
}
|
||||
|
||||
public uninstall(version: BSVersion): Promise<boolean> {
|
||||
return lastValueFrom(this.ipcService.sendV2("bs.uninstall", version)).catch(() => false);
|
||||
public uninstall(version: BSVersion): Promise<void> {
|
||||
return lastValueFrom(this.ipcService.sendV2("bs.uninstall", version));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user