[feature-274] Add success notification oculus download + not restart download after auto-download oculus if success to downloas some files + change translation + fix error when viewing an official version

This commit is contained in:
MathieuG-P
2023-10-29 09:25:37 +01:00
parent 0645e88307
commit 78d55bd6ae
11 changed files with 43 additions and 35 deletions
+1 -1
View File
@@ -261,7 +261,7 @@
"oculus-download": {
"errors": {
"msg": {
"DOWNLOAD_MANIFEST_FAILED": "Unmöglich, das Manifest für diese Version herunterzuladen.",
"DOWNLOAD_MANIFEST_FAILED": "Es ist nicht möglich, das Manifest für diese Version herunterzuladen; Ihr Anmelde-Token ist möglicherweise ungültig.",
"MANIFEST_FILE_NOT_FOUND": "Unmöglich, das Manifest für diese Version zu finden.",
"PARSE_MANIFEST_FILE_FAILED": "Beim Lesen des Manifests ist ein Fehler aufgetreten.",
"ALREADY_DOWNLOADING": "Eine Version wird bereits heruntergeladen.",
+1 -1
View File
@@ -261,7 +261,7 @@
"oculus-download": {
"errors": {
"msg": {
"DOWNLOAD_MANIFEST_FAILED": "Unable to download the manifest for this version.",
"DOWNLOAD_MANIFEST_FAILED": "Unable to download the manifest for this version; your login token may be invalid.",
"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.",
+1 -1
View File
@@ -260,7 +260,7 @@
"oculus-download": {
"errors": {
"msg": {
"DOWNLOAD_MANIFEST_FAILED": "Imposible descargar el manifiesto de esta versión.",
"DOWNLOAD_MANIFEST_FAILED": "No se puede descargar el manifiesto de esta versión; su token de inicio de sesión podría ser inválido.",
"MANIFEST_FILE_NOT_FOUND": "Imposible encontrar el manifiesto de esta versión.",
"PARSE_MANIFEST_FILE_FAILED": "Se produjo un error al leer el manifiesto.",
"ALREADY_DOWNLOADING": "Ya se está descargando una versión.",
+3 -3
View File
@@ -209,8 +209,8 @@
"bs-download": {
"success": {
"titles": {
"download-success": "Téléchargement terminé 🎉",
"verification-finished": "Vérification terminée 🎉"
"download-success": "Téléchargement terminé",
"verification-finished": "Vérification terminée"
}
},
"steam-download": {
@@ -257,7 +257,7 @@
"oculus-download": {
"errors": {
"msg": {
"DOWNLOAD_MANIFEST_FAILED": "Impossible de télécharger le manifest de cette version.",
"DOWNLOAD_MANIFEST_FAILED": "Impossible de télécharger le manifest de cette version; vote token de connexion est peut-être invalide.",
"MANIFEST_FILE_NOT_FOUND": "Impossible de trouver le manifest de cette version.",
"PARSE_MANIFEST_FILE_FAILED": "Une erreur c'est produite lors de la lecture du manifest.",
"ALREADY_DOWNLOADING": "Une version est déjà en cours de téléchargement.",
+1 -1
View File
@@ -261,7 +261,7 @@
"oculus-download": {
"errors": {
"msg": {
"DOWNLOAD_MANIFEST_FAILED": "Невозможно загрузить манифест этой версии.",
"DOWNLOAD_MANIFEST_FAILED": "Невозможно загрузить манифест этой версии; ваш токен входа, возможно, недействителен.",
"MANIFEST_FILE_NOT_FOUND": "Невозможно найти манифест этой версии.",
"PARSE_MANIFEST_FILE_FAILED": "При чтении манифеста произошла ошибка.",
"ALREADY_DOWNLOADING": "Версия уже загружается.",
@@ -7,7 +7,7 @@ import { OculusDownloader } from "../../models/oculus-downloader.class";
import { Cookie, session } from "electron";
import { Progression, ensurePathNotAlreadyExist } from "../../helpers/fs.helpers";
import { BSLocalVersionService } from "../bs-local-version.service";
import { Observable, catchError, finalize, from, map, switchMap, throwError } from "rxjs";
import { Observable, finalize, from, map, switchMap } from "rxjs";
import path from "path";
import { DownloadInfo } from "./bs-steam-downloader.service";
import { BsStore } from "../../../shared/models/bs-store.enum";
@@ -163,7 +163,6 @@ export class BsOculusDownloaderService {
public autoDownloadVersion(downloadInfo: DownloadInfo): Observable<Progression<BSVersion>>{
let failed = false;
let downloadVersion: BSVersion
return from(this.getAuthToken()).pipe(
@@ -185,11 +184,7 @@ export class BsOculusDownloaderService {
map(progress => ({...progress, data: version})),
);
}),
catchError(err => {
failed = true;
return throwError(() => err);
}),
finalize(() => from(!failed && this.versions.setVersionMetadata(downloadVersion, "store", BsStore.OCULUS))),
finalize(() => downloadVersion && this.versions.setVersionMetadata(downloadVersion, "store", BsStore.OCULUS)),
finalize(() => this.oculusDownloader.stopDownload()),
);
}
@@ -8,7 +8,7 @@ import { InstallationLocationService } from "../installation-location.service";
import { BSLocalVersionService } from "../bs-local-version.service";
import { ensureDir } from "fs-extra";
import { ensurePathNotAlreadyExist } from "../../helpers/fs.helpers";
import { Observable, catchError, finalize, map, throwError } from "rxjs";
import { Observable, finalize, map } from "rxjs";
import { DepotDownloaderArgsOptions, DepotDownloaderErrorEvent, DepotDownloaderEvent, DepotDownloaderEventType, DepotDownloaderInfoEvent } from "../../../shared/models/bs-version-download/depot-downloader.model";
import { DepotDownloader } from "../../models/depot-downloader.class";
import { app } from "electron";
@@ -107,8 +107,6 @@ export class BsSteamDownloaderService {
this.depotDownloader = depotDownloader;
let failed = false;
depotDownloader.$events().pipe(
map(event => {
if(event.type === DepotDownloaderEventType.Error){
@@ -116,13 +114,7 @@ export class BsSteamDownloaderService {
}
return event;
}),
catchError(err => {
failed = true;
return throwError(() => err);
}),
finalize(() => {
!failed && this.localVersionService.setVersionMetadata(version, "store", BsStore.STEAM);
})
finalize(() => this.localVersionService.setVersionMetadata(version, "store", BsStore.STEAM))
).subscribe(sub);
}).catch(err => sub.error({
+1 -1
View File
@@ -47,7 +47,7 @@ export class IpcService {
const sub = observable.subscribe({
next: data => this.send(channel, window, data),
error: error => {
log.error(error);
log.error(error, error?.code);
this.send(this.getErrorChannel(channel), window, serializeError(error));
},
complete: () => this.send(this.getCompleteChannel(channel), window)
@@ -29,8 +29,8 @@ export const LoginToMetaModal: ModalComponent<boolean> = ({ resolver }) => {
</p>
<p>
En vous connectant à Meta, une fenètre de connexion s'ouvrira et vous pourrais alors débuter le processus de connexion à Meta.
Veuillez bien à accepter les cookie sinon quoi, il se pourrait que l'on arrive pas à récupérer votre token de connexion.
En vous connectant à Meta, une fenètre de connexion s'ouvrira et vous pourrez alors débuter le processus de connexion.
Veuillez à bien accepter les cookies sinon quoi, il se pourrait que l'on arrive pas à récupérer votre token de connexion pour démarrer le téléchargement.
</p>
<div className="w-full flex flex-row justify-start items-center gap-1.5">
@@ -64,7 +64,7 @@ export function LaunchSlide({ version }: Props) {
desktop: desktopMode,
debug: debugMode,
additionalArgs
})
});
};
return (
@@ -74,7 +74,7 @@ export function LaunchSlide({ version }: Props) {
<h1 className="relative text-4xl font-bold italic -top-3">{version.name ? `${version.BSVersion} - ${version.name}` : version.BSVersion}</h1>
</div>
<div className="grid grid-flow-col gap-6">
{!(version.oculus || version.metadata.store === BsStore.OCULUS) && <LaunchModToogle infoText="pages.version-viewer.launch-mods.oculus-description" icon="oculus" onClick={() => setMode(LaunchMods.OCULUS_MOD, !oculusMode)} active={oculusMode} text="pages.version-viewer.launch-mods.oculus" />}
{!(version.oculus || version.metadata?.store === BsStore.OCULUS) && <LaunchModToogle infoText="pages.version-viewer.launch-mods.oculus-description" icon="oculus" onClick={() => setMode(LaunchMods.OCULUS_MOD, !oculusMode)} active={oculusMode} text="pages.version-viewer.launch-mods.oculus" />}
<LaunchModToogle infoText="pages.version-viewer.launch-mods.desktop-description" icon="desktop" onClick={() => setMode(LaunchMods.DESKTOP_MOD, !desktopMode)} active={desktopMode} text="pages.version-viewer.launch-mods.desktop" />
<LaunchModToogle infoText="pages.version-viewer.launch-mods.debug-description" icon="terminal" onClick={() => setMode(LaunchMods.DEBUG_MOD, !debugMode)} active={debugMode} text="pages.version-viewer.launch-mods.debug" />
</div>
@@ -85,13 +85,23 @@ export class OculusDownloaderService extends AbstractBsDownloaderService impleme
}
private async doDownloadBsVersion(bsVersion: BSVersion, isVerification: boolean): Promise<BSVersion> {
let autoDownloadFailed = false;
return (async () => {
const autoDownload = await lastValueFrom(this.tryAutoDownload({ bsVersion, isVerification })).then(() => true).catch(() => false);
const autoDownload = await lastValueFrom(this.tryAutoDownload({ bsVersion, isVerification })).then(() => true).catch((err: CustomError) => {
const doNotRestartCodes: string[] = [OculusDownloaderErrorCodes.ALREADY_DOWNLOADING, OculusDownloaderErrorCodes.SOME_FILES_FAILED_TO_DOWNLOAD, OculusDownloaderErrorCodes.VERIFY_INTEGRITY_FAILED];
autoDownloadFailed = true;
if(doNotRestartCodes.includes(err?.code)){
return true;
}
return false;
});
if(autoDownload){
return autoDownload;
}
if(autoDownload){ return autoDownload; }
const [completed, stay] = await this.modals.openModal(LoginToMetaModal).then(res => [res.exitCode === ModalExitCode.COMPLETED, res.data]);
@@ -101,8 +111,19 @@ export class OculusDownloaderService extends AbstractBsDownloaderService impleme
return lastValueFrom(this.startDownloadBsVersion({ bsVersion, isVerification, stay })).then(() => true);
})().then(() => bsVersion)
.finally(() => this.progressBar.hide(true));
})().then(() => {
if(autoDownloadFailed){
return bsVersion;
}
if(isVerification){
this.notifications.notifySuccess({title: "notifications.bs-download.success.titles.verification-finished"});
} else {
this.notifications.notifySuccess({title: "notifications.bs-download.success.titles.download-success"});
}
return bsVersion;
}).finally(() => this.progressBar.hide(true));
}
public downloadBsVersion(version: BSVersion): Promise<BSVersion> {