Add information to inform the users that they must have the desktop version of Beat Saber

This commit is contained in:
Zagrios
2025-02-21 16:55:11 +01:00
parent f800118d10
commit 14f079b50c
3 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -406,7 +406,7 @@
"oculus-download": {
"errors": {
"msg": {
"DOWNLOAD_MANIFEST_FAILED": "Unable to download the manifest for this version; your login token may be invalid.",
"DOWNLOAD_MANIFEST_FAILED": "Unable to download the manifest. Your login token may be invalid, or you don't own the desktop version of Beat Saber.",
"MANIFEST_FILE_NOT_FOUND": "Unable to find the manifest for this version.",
"PARSE_MANIFEST_FILE_FAILED": "An error occurred while reading the manifest.",
"ALREADY_DOWNLOADING": "A version is already being downloaded.",
@@ -60,6 +60,8 @@ export const LoginToMetaModal: ModalComponent<string> = ({ resolver }) => {
<p className="font-bold">{t("modals.connect-to-meta.body.token-needed")}</p>
<p>{t("modals.connect-to-meta.body.need-cookie-enabled")}</p>
<p className="text-warning-400">You must own the desktop version of Beat Saber. If you bought it on the standalone store, follow <a className="underline cursor-pointer">this guide</a> to claim it.</p>
<div className="w-full flex flex-row justify-start items-center gap-1.5">
<BsmCheckbox className="relative z-[1] w-6 aspect-square" checked={stay} onChange={enable => setStay(() => enable)}/>
<span>{t("modals.connect-to-meta.stay")}</span>
@@ -11,6 +11,8 @@ import { AbstractBsDownloaderService } from "./abstract-bs-downloader.service";
import { MetaAuthErrorCodes, OculusDownloaderErrorCodes } from "shared/models/bs-version-download/oculus-download.model";
import { LoginToMetaModal } from "renderer/components/modal/modal-types/bs-downgrade/login-to-meta-modal.component";
import { OculusDownloadInfo } from "main/services/bs-version-download/bs-oculus-downloader.service";
import { Notification } from "shared/models/notification/notification.model";
import { LinkOpenerService } from "../link-opener.service";
export class OculusDownloaderService extends AbstractBsDownloaderService implements DownloaderServiceInterface{
@@ -28,6 +30,7 @@ export class OculusDownloaderService extends AbstractBsDownloaderService impleme
private readonly progressBar: ProgressBarService;
private readonly notifications: NotificationService;
private readonly modals: ModalService;
private readonly linkOpener: LinkOpenerService;
private readonly DISPLAYABLE_ERROR_CODES: string[] = [...Object.values(MetaAuthErrorCodes), ...Object.values(OculusDownloaderErrorCodes)];
@@ -37,11 +40,18 @@ export class OculusDownloaderService extends AbstractBsDownloaderService impleme
this.progressBar = ProgressBarService.getInstance();
this.notifications = NotificationService.getInstance();
this.modals = ModalService.getInstance();
this.linkOpener = LinkOpenerService.getInstance();
}
private handleDownloadErrors(err: CustomError): Promise<void>{
if(!err?.code || !this.DISPLAYABLE_ERROR_CODES.includes(err.code)){
return this.notifications.notifyError({title: "notifications.types.error", desc: `notifications.bs-download.oculus-download.errors.msg.UNKNOWN_ERROR`}).then(noop);
return this.notifications.notifyError({title: "notifications.types.error", desc: `notifications.bs-download.oculus-download.errors.msg.UNKNOWN_ERROR`, duration: 9000}).then(noop);
}
const notificationData: Notification = {title: "notifications.types.error", desc: `notifications.bs-download.oculus-download.errors.msg.${err.code}`, duration: 9000};
if(err.code === OculusDownloaderErrorCodes.DOWNLOAD_MANIFEST_FAILED){
notificationData.actions = [{ id: "0", title: "Claim your desktop version" }]
return this.notifications.notifyError(notificationData).then(action => action === "0" && this.linkOpener.open(""))
}
return this.notifications.notifyError({title: "notifications.types.error", desc: `notifications.bs-download.oculus-download.errors.msg.${err.code}`}).then(noop);