@sumaris-net/ngx-components 0.25.5 → 0.25.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21329,6 +21329,7 @@
21329
21329
  this._subscription = new rxjs.Subscription();
21330
21330
  this._showUpdateOfflineFeature = false;
21331
21331
  this.loading = true;
21332
+ this.downloading = false;
21332
21333
  this.waitingNetwork = false;
21333
21334
  this.showUpgradeWarning = true;
21334
21335
  this.showOfflineWarning = true;
@@ -21387,19 +21388,17 @@
21387
21388
  };
21388
21389
  AppInstallUpgradeCard.prototype.download = function (event, link) {
21389
21390
  return __awaiter(this, void 0, void 0, function () {
21390
- var job;
21391
21391
  return __generator(this, function (_a) {
21392
21392
  if (!link || !link.url) {
21393
21393
  console.error('[install-upgrade-card] Missing required argument \'link.url\'');
21394
21394
  return [2 /*return*/]; // Skip
21395
21395
  }
21396
- job = this.platform.download({
21397
- uri: link.url,
21398
- title: link.title,
21399
- filename: link.filename,
21400
- mimeType: link.mimeType
21401
- });
21402
- return [2 /*return*/, this.listenDownloadPromise(link, job)];
21396
+ return [2 /*return*/, this.listenDownloadPromise(link.url, this.platform.download({
21397
+ uri: link.url,
21398
+ title: link.title,
21399
+ filename: link.filename,
21400
+ mimeType: link.mimeType
21401
+ }))];
21403
21402
  });
21404
21403
  });
21405
21404
  };
@@ -21469,14 +21468,11 @@
21469
21468
  this.markForCheck();
21470
21469
  return [7 /*endfinally*/];
21471
21470
  case 4:
21472
- // Listening downloading files
21471
+ // Listening downloading promise, if exists
21473
21472
  (this.upgradeLinks || []).forEach(function (link) {
21474
21473
  var promise = _this.platform.getDownloadingPromise(link.url);
21475
- // Listening download promise, if exists
21476
- if (promise) {
21477
- console.info("[install-upgrade-card] Platform is already downloading this file '" + link.url + "': listening promise...");
21478
- _this.listenDownloadPromise(link, promise);
21479
- }
21474
+ if (promise)
21475
+ _this.listenDownloadPromise(link.url, promise);
21480
21476
  });
21481
21477
  return [2 /*return*/];
21482
21478
  }
@@ -21589,20 +21585,21 @@
21589
21585
  });
21590
21586
  });
21591
21587
  };
21592
- AppInstallUpgradeCard.prototype.listenDownloadPromise = function (link, promise) {
21588
+ AppInstallUpgradeCard.prototype.listenDownloadPromise = function (url, promise) {
21593
21589
  return __awaiter(this, void 0, void 0, function () {
21594
21590
  var location, err_1;
21595
21591
  return __generator(this, function (_a) {
21596
21592
  switch (_a.label) {
21597
21593
  case 0:
21598
- if (!link || !promise)
21594
+ if (!url || !promise)
21599
21595
  return [2 /*return*/]; // Skip
21600
21596
  _a.label = 1;
21601
21597
  case 1:
21602
21598
  _a.trys.push([1, 3, 4, 5]);
21603
- // Mark link as loading
21604
- if (!link.downloading) {
21605
- link.downloading = true;
21599
+ // Mark as downloading
21600
+ if (!this.downloading) {
21601
+ console.info("[install-upgrade-card] Platform is downloading '" + url + "' ...");
21602
+ this.downloading = true;
21606
21603
  this.markForCheck();
21607
21604
  }
21608
21605
  return [4 /*yield*/, promise];
@@ -21613,10 +21610,9 @@
21613
21610
  case 3:
21614
21611
  err_1 = _a.sent();
21615
21612
  console.error('[install-upgrade] Download failed: ' + (err_1 && err_1.message || err_1));
21616
- this.showDownloadFailedToast(err_1);
21617
- return [3 /*break*/, 5];
21613
+ return [2 /*return*/, this.showDownloadFailedToast(err_1)];
21618
21614
  case 4:
21619
- link.downloading = false;
21615
+ this.downloading = false;
21620
21616
  this.markForCheck();
21621
21617
  return [7 /*endfinally*/];
21622
21618
  case 5: return [2 /*return*/, this.showDownloadCompleteDialog()];