Commit 8d119d4d authored by wudizhanche1000's avatar wudizhanche1000

Fix: Aria2 载失败提示

parent 2a08d696
......@@ -90,22 +90,28 @@ export class AppDetailComponent implements OnInit {
try {
let downloadApps = await this.downloadService.addUris(apps, downloadPath);
for (let app of apps) {
this.downloadService.getProgress(app)
.subscribe((progress) => {
app.status.status = "downloading";
app.status.progress = progress.progress;
app.status.total = progress.total;
this.ref.detectChanges();
},
(error) => {
},
() => {
// 避免安装过快
if (app.status.status === "downloading") {
app.status.status = "waiting";
await new Promise((resolve, reject) => {
this.downloadService.getProgress(app)
.subscribe((progress) => {
app.status.status = "downloading";
app.status.progress = progress.progress;
app.status.total = progress.total;
this.ref.detectChanges();
}
});
resolve();
},
(error) => {
reject(`download error: ${error}`);
},
() => {
// 避免安装过快
if (app.status.status === "downloading") {
app.status.status = "waiting";
this.ref.detectChanges();
}
});
});
}
await Promise.all(downloadApps.map((app) => {
......
......@@ -59,6 +59,7 @@ export class DownloadService {
} else if (status.status === "active") {
observer.next({total: status.totalLength, progress: status.completedLength})
} else if (status.status === "error") {
console.log("error", status.errorCode);
observer.error(status.errorCode)
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment