@sumaris-net/ngx-components 0.25.9 → 0.25.10
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.
- package/bundles/sumaris-net.ngx-components.umd.js +67 -60
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/install/install-upgrade-card.component.js +58 -43
- package/fesm2015/sumaris-net.ngx-components.js +54 -39
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/install/install-upgrade-card.component.d.ts +5 -3
- package/src/theme/_icons.scss +0 -2
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -21332,6 +21332,7 @@
|
|
|
21332
21332
|
this._subscription = new rxjs.Subscription();
|
|
21333
21333
|
this._showUpdateOfflineFeature = false;
|
|
21334
21334
|
this.loading = true;
|
|
21335
|
+
this.canDownload = false;
|
|
21335
21336
|
this.downloading = false;
|
|
21336
21337
|
this.waitingNetwork = false;
|
|
21337
21338
|
this.showUpgradeWarning = true;
|
|
@@ -21353,34 +21354,24 @@
|
|
|
21353
21354
|
configurable: true
|
|
21354
21355
|
});
|
|
21355
21356
|
AppInstallUpgradeCard.prototype.ngOnInit = function () {
|
|
21356
|
-
|
|
21357
|
-
|
|
21358
|
-
|
|
21359
|
-
|
|
21360
|
-
|
|
21361
|
-
|
|
21362
|
-
|
|
21363
|
-
|
|
21364
|
-
|
|
21365
|
-
|
|
21366
|
-
|
|
21367
|
-
|
|
21368
|
-
|
|
21369
|
-
|
|
21370
|
-
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
.subscribe(function (offline) {
|
|
21375
|
-
if (_this.offline !== offline) {
|
|
21376
|
-
_this.offline = offline;
|
|
21377
|
-
_this.markForCheck();
|
|
21378
|
-
}
|
|
21379
|
-
}));
|
|
21380
|
-
return [2 /*return*/];
|
|
21381
|
-
}
|
|
21382
|
-
});
|
|
21383
|
-
});
|
|
21357
|
+
var _this = this;
|
|
21358
|
+
this.offline = this.network.offline;
|
|
21359
|
+
// Listen pod config
|
|
21360
|
+
this._subscription.add(rxjs.from(this.network.ready())
|
|
21361
|
+
.pipe(operators.debounceTime(1000), operators.switchMap(function () { return _this.configService.config; }), operators.filter(isNotNil))
|
|
21362
|
+
.subscribe(function (config) { return _this.checkNeedInstallOrUpdate(config); }));
|
|
21363
|
+
// Listen network changes
|
|
21364
|
+
this._subscription.add(this.network.onNetworkStatusChanges
|
|
21365
|
+
.pipe(
|
|
21366
|
+
//debounceTime(450),
|
|
21367
|
+
//tap(() => this.waitingNetwork = false),
|
|
21368
|
+
operators.map(function (connectionType) { return connectionType === 'none'; }), operators.distinctUntilChanged())
|
|
21369
|
+
.subscribe(function (offline) {
|
|
21370
|
+
if (_this.offline !== offline) {
|
|
21371
|
+
_this.offline = offline;
|
|
21372
|
+
_this.markForCheck();
|
|
21373
|
+
}
|
|
21374
|
+
}));
|
|
21384
21375
|
};
|
|
21385
21376
|
AppInstallUpgradeCard.prototype.ngOnDestroy = function () {
|
|
21386
21377
|
this._subscription.unsubscribe();
|
|
@@ -21449,35 +21440,39 @@
|
|
|
21449
21440
|
AppInstallUpgradeCard.prototype.checkNeedInstallOrUpdate = function (config) {
|
|
21450
21441
|
return __awaiter(this, void 0, void 0, function () {
|
|
21451
21442
|
var links;
|
|
21452
|
-
var _this = this;
|
|
21453
21443
|
return __generator(this, function (_a) {
|
|
21454
21444
|
switch (_a.label) {
|
|
21455
21445
|
case 0:
|
|
21456
|
-
|
|
21446
|
+
if (!config)
|
|
21447
|
+
return [2 /*return*/]; // Skip
|
|
21448
|
+
console.info('[install-upgrade-card] Check if need to install or upgrade...');
|
|
21449
|
+
this.canDownload = this.platform.canDownload;
|
|
21457
21450
|
_a.label = 1;
|
|
21458
21451
|
case 1:
|
|
21459
|
-
_a.trys.push([1, ,
|
|
21452
|
+
_a.trys.push([1, , 5, 6]);
|
|
21460
21453
|
links = this.getLinks(config);
|
|
21461
21454
|
// Check for upgrade
|
|
21462
21455
|
this.upgradeLinks = this.getCompatibleUpgradeLinks(links, config);
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
_a.sent(); // Add a delay, for animation
|
|
21456
|
+
if (!isNotEmptyArray(this.upgradeLinks)) return [3 /*break*/, 2];
|
|
21457
|
+
console.info("[install-upgrade-card] Find upgrade links: " + this.upgradeLinks.map(function (l) { return l.url; }).join(','));
|
|
21458
|
+
this.installLinks = null;
|
|
21459
|
+
this.listenDownloadJobs();
|
|
21468
21460
|
return [3 /*break*/, 4];
|
|
21461
|
+
case 2:
|
|
21462
|
+
// Check for install links
|
|
21463
|
+
this.installLinks = this.getCompatibleInstallLinks(links);
|
|
21464
|
+
if (!isNotEmptyArray(this.installLinks)) return [3 /*break*/, 4];
|
|
21465
|
+
console.info("[install-upgrade-card] Find install links " + this.installLinks.map(function (l) { return l.url; }).join(','));
|
|
21466
|
+
return [4 /*yield*/, sleep(1000)];
|
|
21469
21467
|
case 3:
|
|
21468
|
+
_a.sent(); // Add a delay, for animation
|
|
21469
|
+
_a.label = 4;
|
|
21470
|
+
case 4: return [3 /*break*/, 6];
|
|
21471
|
+
case 5:
|
|
21470
21472
|
this.loading = false;
|
|
21471
21473
|
this.markForCheck();
|
|
21472
21474
|
return [7 /*endfinally*/];
|
|
21473
|
-
case
|
|
21474
|
-
// Listening downloading promise, if exists
|
|
21475
|
-
(this.upgradeLinks || []).forEach(function (link) {
|
|
21476
|
-
var job = _this.platform.getDownloadingJob(link.url);
|
|
21477
|
-
if (job)
|
|
21478
|
-
_this.listenDownloadJob(link.url, job);
|
|
21479
|
-
});
|
|
21480
|
-
return [2 /*return*/];
|
|
21475
|
+
case 6: return [2 /*return*/];
|
|
21481
21476
|
}
|
|
21482
21477
|
});
|
|
21483
21478
|
});
|
|
@@ -21573,19 +21568,13 @@
|
|
|
21573
21568
|
}
|
|
21574
21569
|
return filename;
|
|
21575
21570
|
};
|
|
21576
|
-
AppInstallUpgradeCard.prototype.
|
|
21577
|
-
this
|
|
21578
|
-
|
|
21579
|
-
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
case 0: return [4 /*yield*/, Toasts.show(this.toastController, this.translate, opts)];
|
|
21584
|
-
case 1:
|
|
21585
|
-
_a.sent();
|
|
21586
|
-
return [2 /*return*/];
|
|
21587
|
-
}
|
|
21588
|
-
});
|
|
21571
|
+
AppInstallUpgradeCard.prototype.listenDownloadJobs = function () {
|
|
21572
|
+
var _this = this;
|
|
21573
|
+
// Listening downloading promise, if exists
|
|
21574
|
+
(this.upgradeLinks || []).forEach(function (link) {
|
|
21575
|
+
var job = _this.platform.getDownloadingJob(link.url);
|
|
21576
|
+
if (job)
|
|
21577
|
+
_this.listenDownloadJob(link.url, job);
|
|
21589
21578
|
});
|
|
21590
21579
|
};
|
|
21591
21580
|
AppInstallUpgradeCard.prototype.listenDownloadJob = function (url, job) {
|
|
@@ -21601,7 +21590,7 @@
|
|
|
21601
21590
|
_a.trys.push([1, 3, 4, 5]);
|
|
21602
21591
|
// Mark as downloading
|
|
21603
21592
|
if (!this.downloading) {
|
|
21604
|
-
console.info("[install-upgrade-card] Platform is downloading '" + url + "' ...");
|
|
21593
|
+
console.info("[install-upgrade-card] Platform is already downloading '" + url + "' ...");
|
|
21605
21594
|
this.downloading = true;
|
|
21606
21595
|
this.markForCheck();
|
|
21607
21596
|
}
|
|
@@ -21615,7 +21604,7 @@
|
|
|
21615
21604
|
return [3 /*break*/, 5];
|
|
21616
21605
|
case 3:
|
|
21617
21606
|
err_1 = _a.sent();
|
|
21618
|
-
console.error('[install-upgrade] Download failed: ' + (err_1 && err_1.message || err_1));
|
|
21607
|
+
console.error('[install-upgrade-card] Download failed: ' + (err_1 && err_1.message || err_1));
|
|
21619
21608
|
return [2 /*return*/, this.showDownloadFailedToast(err_1)];
|
|
21620
21609
|
case 4:
|
|
21621
21610
|
this.downloading = false;
|
|
@@ -21673,12 +21662,30 @@
|
|
|
21673
21662
|
});
|
|
21674
21663
|
});
|
|
21675
21664
|
};
|
|
21665
|
+
AppInstallUpgradeCard.prototype.markForCheck = function () {
|
|
21666
|
+
this.cd.markForCheck();
|
|
21667
|
+
};
|
|
21668
|
+
AppInstallUpgradeCard.prototype.showToast = function (opts) {
|
|
21669
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
21670
|
+
return __generator(this, function (_a) {
|
|
21671
|
+
switch (_a.label) {
|
|
21672
|
+
case 0:
|
|
21673
|
+
if (!this._subscription)
|
|
21674
|
+
return [2 /*return*/]; // Skip if component has been destroyed
|
|
21675
|
+
return [4 /*yield*/, Toasts.show(this.toastController, this.translate, opts)];
|
|
21676
|
+
case 1:
|
|
21677
|
+
_a.sent();
|
|
21678
|
+
return [2 /*return*/];
|
|
21679
|
+
}
|
|
21680
|
+
});
|
|
21681
|
+
});
|
|
21682
|
+
};
|
|
21676
21683
|
return AppInstallUpgradeCard;
|
|
21677
21684
|
}());
|
|
21678
21685
|
AppInstallUpgradeCard.decorators = [
|
|
21679
21686
|
{ type: i0.Component, args: [{
|
|
21680
21687
|
selector: 'app-install-upgrade-card',
|
|
21681
|
-
template: "\n\n<!-- Offline mode card-->\n<ion-card *ngIf=\"showOfflineWarning && (!loading && offline || waitingNetwork)\"\n color=\"accent\"\n class=\"main ion-no-margin\"\n @slideUpDownAnimation>\n <ion-card-content class=\"ion-no-padding\">\n <ion-grid>\n <ion-row>\n <ion-col>\n <ion-text class=\"ion-text-wrap\" *ngIf=\"!waitingNetwork; else waitingNetworkText\">\n <h4>\n <b *ngIf=\"isLogin; else notLogin\" [innerHTML]=\"'NETWORK.INFO.OFFLINE_OR_UNAUTHORIZED'| translate\"></b>\n <ng-template #notLogin>\n <b [innerHTML]=\"'NETWORK.INFO.OFFLINE'| translate\"></b>\n </ng-template>\n </h4>\n <h3>\n <small [innerHTML]=\"'NETWORK.INFO.OFFLINE_HELP'|translate\"></small>\n </h3>\n </ion-text>\n <ng-template #waitingNetworkText>\n <ion-text class=\"ion-text-wrap\" [innerHTML]=\"'NETWORK.INFO.RETRY_TO_CONNECT'| translate\"></ion-text>\n </ng-template>\n </ion-col>\n <ion-col size=\"auto\">\n\n <!-- Retry button -->\n <ion-button *ngIf=\"!waitingNetwork; else waitingSpinner\" color=\"tertiary\" class=\"ion-float-end\"\n (click)=\"tryOnline()\">\n <span translate>NETWORK.BTN_CHECK_ALIVE</span>\n </ion-button>\n\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n<!-- Upgrade links -->\n<ion-card *ngIf=\"showUpgradeWarning && !loading && !offline && upgradeLinks\"\n color=\"accent\"\n class=\"ion-no-margin\"\n @slideUpDownAnimation>\n <ion-card-content class=\"ion-no-padding\">\n <ion-grid>\n <ion-row *ngFor=\"let link of upgradeLinks; last as last\">\n <ion-col>\n <ion-text class=\"ion-text-wrap\">\n <h3>\n <span *ngIf=\"link.version\" [innerHTML]=\"'INFO.UPDATE_APP_TO_VERSION'| translate: link\"></span>\n <span *ngIf=\"!link.version\" [innerHTML]=\"'INFO.UPDATE_APP'| translate: link\"></span>\n </h3>\n <h4>\n <small *ngIf=\"last\" [innerHTML]=\"'INFO.UPDATE_APP_HELP'|translate\"></small>\n </h4>\n </ion-text>\n </ion-col>\n\n <ion-col size=\"auto\">\n <ng-container *ngTemplateOutlet=\"downloadButton; context: { $implicit: link }\"></ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n<!-- Install links -->\n<ion-card *ngIf=\"showInstallButton && !loading && !offline && installLinks\"\n color=\"secondary\"\n class=\"ion-no-margin\"\n @slideUpDownAnimation>\n <ion-card-content class=\"ion-no-padding\">\n <ion-grid>\n <ion-row *ngFor=\"let link of installLinks; last as last\">\n <ion-col>\n <ion-text class=\"ion-text-wrap\">\n <h3 [innerHTML]=\"'INFO.DOWNLOAD_APP_TITLE'| translate: {name: link.name, platform: getPlatformName(link.platform) }\"></h3>\n <h4><small *ngIf=\"last\" [innerHTML]=\"'INFO.DOWNLOAD_APP_HELP'|translate\"></small></h4>\n </ion-text>\n </ion-col>\n <ion-col size=\"auto\">\n <ng-container *ngTemplateOutlet=\"downloadButton; context: { $implicit: link }\"></ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n<!-- Update offline feature card-->\n<ion-card *ngIf=\"showUpdateOfflineFeature && !loading && !offline\"\n color=\"accent\"\n class=\"main ion-no-margin\"\n @slideUpDownAnimation>\n <ion-card-content class=\"ion-no-padding\">\n <ion-grid>\n <ion-row>\n <ion-col>\n <ion-text class=\"ion-text-wrap\">\n <h4>\n <b [innerHTML]=\"'NETWORK.INFO.UPDATE_OFFLINE_MODE'| translate\"></b>\n </h4>\n <h3>\n <small [innerHTML]=\"'NETWORK.INFO.UPDATE_OFFLINE_MODE_HELP'|translate\"></small>\n </h3>\n </ion-text>\n </ion-col>\n <ion-col size=\"auto\">\n\n <!-- Retry button -->\n <ion-button color=\"tertiary\" class=\"ion-float-end\"\n (click)=\"onUpdateOfflineModeClick.emit($event)\">\n <span translate>NETWORK.BTN_UPDATE</span>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n<!-- Display a download button, depending on the link URL, and the device platform -->\n<ng-template #downloadButton let-link>\n\n <ng-container *ngIf=\"link.
|
|
21688
|
+
template: "\n\n<!-- Offline mode card-->\n<ion-card *ngIf=\"showOfflineWarning && (!loading && offline || waitingNetwork)\"\n color=\"accent\"\n class=\"main ion-no-margin\"\n @slideUpDownAnimation>\n <ion-card-content class=\"ion-no-padding\">\n <ion-grid>\n <ion-row>\n <ion-col>\n <ion-text class=\"ion-text-wrap\" *ngIf=\"!waitingNetwork; else waitingNetworkText\">\n <h4>\n <b *ngIf=\"isLogin; else notLogin\" [innerHTML]=\"'NETWORK.INFO.OFFLINE_OR_UNAUTHORIZED'| translate\"></b>\n <ng-template #notLogin>\n <b [innerHTML]=\"'NETWORK.INFO.OFFLINE'| translate\"></b>\n </ng-template>\n </h4>\n <h3>\n <small [innerHTML]=\"'NETWORK.INFO.OFFLINE_HELP'|translate\"></small>\n </h3>\n </ion-text>\n <ng-template #waitingNetworkText>\n <ion-text class=\"ion-text-wrap\" [innerHTML]=\"'NETWORK.INFO.RETRY_TO_CONNECT'| translate\"></ion-text>\n </ng-template>\n </ion-col>\n <ion-col size=\"auto\">\n\n <!-- Retry button -->\n <ion-button *ngIf=\"!waitingNetwork; else waitingSpinner\" color=\"tertiary\" class=\"ion-float-end\"\n (click)=\"tryOnline()\">\n <span translate>NETWORK.BTN_CHECK_ALIVE</span>\n </ion-button>\n\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n<!-- Upgrade links -->\n<ion-card *ngIf=\"showUpgradeWarning && !loading && !offline && upgradeLinks\"\n color=\"accent\"\n class=\"ion-no-margin\"\n @slideUpDownAnimation>\n <ion-card-content class=\"ion-no-padding\">\n <ion-grid>\n <ion-row *ngFor=\"let link of upgradeLinks; last as last\">\n <ion-col>\n <ion-text class=\"ion-text-wrap\">\n <h3>\n <span *ngIf=\"link.version\" [innerHTML]=\"'INFO.UPDATE_APP_TO_VERSION'| translate: link\"></span>\n <span *ngIf=\"!link.version\" [innerHTML]=\"'INFO.UPDATE_APP'| translate: link\"></span>\n </h3>\n <h4>\n <small *ngIf=\"last\" [innerHTML]=\"'INFO.UPDATE_APP_HELP'|translate\"></small>\n </h4>\n </ion-text>\n </ion-col>\n\n <ion-col size=\"auto\">\n <ng-container *ngTemplateOutlet=\"downloadButton; context: { $implicit: link }\"></ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n<!-- Install links -->\n<ion-card *ngIf=\"showInstallButton && !loading && !offline && installLinks\"\n color=\"secondary\"\n class=\"ion-no-margin\"\n @slideUpDownAnimation>\n <ion-card-content class=\"ion-no-padding\">\n <ion-grid>\n <ion-row *ngFor=\"let link of installLinks; last as last\">\n <ion-col>\n <ion-text class=\"ion-text-wrap\">\n <h3 [innerHTML]=\"'INFO.DOWNLOAD_APP_TITLE'| translate: {name: link.name, platform: getPlatformName(link.platform) }\"></h3>\n <h4><small *ngIf=\"last\" [innerHTML]=\"'INFO.DOWNLOAD_APP_HELP'|translate\"></small></h4>\n </ion-text>\n </ion-col>\n <ion-col size=\"auto\">\n <ng-container *ngTemplateOutlet=\"downloadButton; context: { $implicit: link }\"></ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n<!-- Update offline feature card-->\n<ion-card *ngIf=\"showUpdateOfflineFeature && !loading && !offline\"\n color=\"accent\"\n class=\"main ion-no-margin\"\n @slideUpDownAnimation>\n <ion-card-content class=\"ion-no-padding\">\n <ion-grid>\n <ion-row>\n <ion-col>\n <ion-text class=\"ion-text-wrap\">\n <h4>\n <b [innerHTML]=\"'NETWORK.INFO.UPDATE_OFFLINE_MODE'| translate\"></b>\n </h4>\n <h3>\n <small [innerHTML]=\"'NETWORK.INFO.UPDATE_OFFLINE_MODE_HELP'|translate\"></small>\n </h3>\n </ion-text>\n </ion-col>\n <ion-col size=\"auto\">\n\n <!-- Retry button -->\n <ion-button color=\"tertiary\" class=\"ion-float-end\"\n (click)=\"onUpdateOfflineModeClick.emit($event)\">\n <span translate>NETWORK.BTN_UPDATE</span>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n<!-- Display a download button, depending on the link URL, and the device platform -->\n<ng-template #downloadButton let-link>\n\n <ng-container *ngIf=\"link.filename; else redirectButton\">\n\n <ng-container *ngIf=\"canDownload; else webDownloadButton\">\n <!-- Download using platform -->\n <ion-button (click)=\"download($event, asLink(link))\"\n [disabled]=\"link.downloading\"\n color=\"tertiary\" class=\"ion-float-end\">\n <ion-icon slot=\"start\" *ngIf=\"!link.downloading\" name=\"download\"></ion-icon>\n <ion-spinner slot=\"start\" class=\"ion-no-padding\" *ngIf=\"link.downloading\"></ion-spinner>\n <ion-label translate>COMMON.BTN_DOWNLOAD</ion-label>\n </ion-button>\n </ng-container>\n\n <!-- Web download button -->\n <ng-template #webDownloadButton>\n <ion-button [download]=\"link.downloadFilename\"\n [href]=\"link.url\"\n color=\"tertiary\" class=\"ion-float-end\" >\n <ion-label translate>COMMON.BTN_DOWNLOAD</ion-label>\n </ion-button>\n </ng-template>\n </ng-container>\n\n <!-- Web redirect button -->\n <ng-template #redirectButton>\n <ion-button [href]=\"link.url\" rel=\"external\" color=\"tertiary\" class=\"ion-float-end\" target=\"_blank\">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n </ion-button>\n </ng-template>\n</ng-template>\n\n\n<!-- Waiting spinner -->\n<ng-template #waitingSpinner>\n <ion-spinner color=\"light\"></ion-spinner>\n</ng-template>\n",
|
|
21682
21689
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
21683
21690
|
animations: [slideUpDownAnimation],
|
|
21684
21691
|
styles: ["ion-text small{font-size:85%}"]
|