mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[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:
@@ -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({
|
||||
|
||||
@@ -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)
|
||||
|
||||
+2
-2
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user