add button to lunch steam when steam is not running

This commit is contained in:
MathieuG-P
2022-12-28 20:30:10 +01:00
parent a8ca0b26b3
commit 06622c4088
6 changed files with 63 additions and 1 deletions
+15 -1
View File
@@ -58,7 +58,21 @@ export class BSLauncherService{
return res;
});
}
if(res.data){ return this.notificationService.notifyError({title: `notifications.bs-launch.errors.titles.${res.data}`}); }
if(res.data){
// TODO : too much nesting here, need refactor
if(res.data === "STEAM_NOT_RUNNING"){
return new Promise(async resolve => {
const notif = await this.notificationService.notifyError({title: `notifications.bs-launch.errors.titles.${res.data}`, actions: [{id: "0", title: `notifications.bs-launch.errors.actions.${res.data}`}]});
if(notif === "0"){
await this.ipcService.send<boolean>("open-steam");
const lastNotif = await this.notificationService.notifySuccess({title: "notifications.steam.steam-launching.title", desc: "notifications.steam.steam-launching.description"});
resolve(lastNotif);
}
resolve(notif)
})
}
return this.notificationService.notifyError({title: `notifications.bs-launch.errors.titles.${res.data}`});
}
return this.notificationService.notifyError({title: res.data || res.error.title});
});
}