Commit ebe6ccea authored by 神楽坂玲奈's avatar 神楽坂玲奈

Merge branch 'v3' of github.com:mycard/mycard into v3

parents ffb86554 8d119d4d
......@@ -90,14 +90,18 @@ export class AppDetailComponent implements OnInit {
try {
let downloadApps = await this.downloadService.addUris(apps, downloadPath);
for (let app of apps) {
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}`);
},
() => {
// 避免安装过快
......@@ -106,6 +110,8 @@ export class AppDetailComponent implements OnInit {
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