Commit 8d119d4d authored by wudizhanche1000's avatar wudizhanche1000

Fix: Aria2 载失败提示

parent 2a08d696
...@@ -90,14 +90,18 @@ export class AppDetailComponent implements OnInit { ...@@ -90,14 +90,18 @@ export class AppDetailComponent implements OnInit {
try { try {
let downloadApps = await this.downloadService.addUris(apps, downloadPath); let downloadApps = await this.downloadService.addUris(apps, downloadPath);
for (let app of apps) { for (let app of apps) {
await new Promise((resolve, reject) => {
this.downloadService.getProgress(app) this.downloadService.getProgress(app)
.subscribe((progress) => { .subscribe((progress) => {
app.status.status = "downloading"; app.status.status = "downloading";
app.status.progress = progress.progress; app.status.progress = progress.progress;
app.status.total = progress.total; app.status.total = progress.total;
this.ref.detectChanges(); this.ref.detectChanges();
resolve();
}, },
(error) => { (error) => {
reject(`download error: ${error}`);
}, },
() => { () => {
// 避免安装过快 // 避免安装过快
...@@ -106,6 +110,8 @@ export class AppDetailComponent implements OnInit { ...@@ -106,6 +110,8 @@ export class AppDetailComponent implements OnInit {
this.ref.detectChanges(); this.ref.detectChanges();
} }
}); });
});
} }
await Promise.all(downloadApps.map((app) => { await Promise.all(downloadApps.map((app) => {
......
...@@ -59,6 +59,7 @@ export class DownloadService { ...@@ -59,6 +59,7 @@ export class DownloadService {
} else if (status.status === "active") { } else if (status.status === "active") {
observer.next({total: status.totalLength, progress: status.completedLength}) observer.next({total: status.totalLength, progress: status.completedLength})
} else if (status.status === "error") { } else if (status.status === "error") {
console.log("error", status.errorCode);
observer.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