@sumaris-net/ngx-components 0.25.0 → 0.25.1
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 +35 -20
- 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 +20 -14
- package/esm2015/src/app/core/services/platform.service.js +11 -8
- package/fesm2015/sumaris-net.ngx-components.js +29 -20
- 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 +4 -4
- package/src/app/core/services/platform.service.d.ts +1 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -15693,6 +15693,13 @@
|
|
|
15693
15693
|
PlatformService.prototype.isAndroidCordova = function () {
|
|
15694
15694
|
return this._android && this._cordova;
|
|
15695
15695
|
};
|
|
15696
|
+
Object.defineProperty(PlatformService.prototype, "canDownload", {
|
|
15697
|
+
get: function () {
|
|
15698
|
+
return !!this.downloader;
|
|
15699
|
+
},
|
|
15700
|
+
enumerable: false,
|
|
15701
|
+
configurable: true
|
|
15702
|
+
});
|
|
15696
15703
|
PlatformService.prototype.width = function () {
|
|
15697
15704
|
return this.platform.width();
|
|
15698
15705
|
};
|
|
@@ -15735,7 +15742,7 @@
|
|
|
15735
15742
|
.then(function () {
|
|
15736
15743
|
_this._started = true;
|
|
15737
15744
|
_this._startPromise = undefined;
|
|
15738
|
-
console.info("[platform] Starting platform [OK] {mobile: " + _this._mobile + ", touchUi: " + _this.touchUi + ", downloader: " +
|
|
15745
|
+
console.info("[platform] Starting platform [OK] {mobile: " + _this._mobile + ", touchUi: " + _this.touchUi + ", downloader: " + _this.canDownload + " in " + (Date.now() - now) + "ms");
|
|
15739
15746
|
// Update cache configuration when network changed
|
|
15740
15747
|
_this.networkService.onNetworkStatusChanges.subscribe(function (type) { return _this.configureCache(type !== 'none'); });
|
|
15741
15748
|
// Update authentication type
|
|
@@ -15785,19 +15792,18 @@
|
|
|
15785
15792
|
};
|
|
15786
15793
|
PlatformService.prototype.download = function (request) {
|
|
15787
15794
|
return __awaiter(this, void 0, void 0, function () {
|
|
15788
|
-
var
|
|
15795
|
+
var location, err_1;
|
|
15789
15796
|
return __generator(this, function (_a) {
|
|
15790
15797
|
switch (_a.label) {
|
|
15791
15798
|
case 0:
|
|
15792
15799
|
if (!request || !request.uri)
|
|
15793
15800
|
throw new Error('Missing argument \'request\' or \'request.uri\'');
|
|
15794
|
-
|
|
15795
|
-
if (!(downloader && this._android && this._cordova)) return [3 /*break*/, 5];
|
|
15801
|
+
if (!this.downloader) return [3 /*break*/, 5];
|
|
15796
15802
|
request = Object.assign(Object.assign({ visibleInDownloadsUi: true, notificationVisibility: ngx$6.NotificationVisibility.VisibleNotifyCompleted, title: request.filename || '' }, request), { destinationInExternalFilesDir: Object.assign({ dirType: 'Downloads', subPath: request.filename || request.title || '' }, request.destinationInExternalFilesDir) });
|
|
15797
15803
|
_a.label = 1;
|
|
15798
15804
|
case 1:
|
|
15799
15805
|
_a.trys.push([1, 3, , 4]);
|
|
15800
|
-
return [4 /*yield*/, downloader.download(request)];
|
|
15806
|
+
return [4 /*yield*/, this.downloader.download(request)];
|
|
15801
15807
|
case 2:
|
|
15802
15808
|
location = _a.sent();
|
|
15803
15809
|
console.info('[platform] File successfully downloaded at:' + location);
|
|
@@ -15928,8 +15934,8 @@
|
|
|
15928
15934
|
case 1:
|
|
15929
15935
|
keys = _a.sent();
|
|
15930
15936
|
if (!isEmptyArray(keys)) return [3 /*break*/, 3];
|
|
15931
|
-
// Drop the old instance
|
|
15932
|
-
console.
|
|
15937
|
+
// Drop the old instance (not need anymore)
|
|
15938
|
+
console.debug("[platform] Old storage is empty: dropping unused instance {name: '" + forage.config().name + "', driver: '" + oldForage.driver() + "'}");
|
|
15933
15939
|
return [4 /*yield*/, oldForage.dropInstance()];
|
|
15934
15940
|
case 2:
|
|
15935
15941
|
_a.sent();
|
|
@@ -21273,11 +21279,11 @@
|
|
|
21273
21279
|
ANDROID_APK: 'application/vnd.android.package-archive'
|
|
21274
21280
|
});
|
|
21275
21281
|
var AppInstallUpgradeCard = /** @class */ (function () {
|
|
21276
|
-
function AppInstallUpgradeCard(modalCtrl, configService,
|
|
21282
|
+
function AppInstallUpgradeCard(modalCtrl, configService, cd, platform, network, environment) {
|
|
21277
21283
|
this.modalCtrl = modalCtrl;
|
|
21278
21284
|
this.configService = configService;
|
|
21279
|
-
this.platform = platform;
|
|
21280
21285
|
this.cd = cd;
|
|
21286
|
+
this.platform = platform;
|
|
21281
21287
|
this.network = network;
|
|
21282
21288
|
this.environment = environment;
|
|
21283
21289
|
this._subscription = new rxjs.Subscription();
|
|
@@ -21288,7 +21294,6 @@
|
|
|
21288
21294
|
this.showOfflineWarning = true;
|
|
21289
21295
|
this.showInstallButton = false;
|
|
21290
21296
|
this.onUpdateOfflineModeClick = new i0.EventEmitter();
|
|
21291
|
-
this.isAndroidCordova = platform.isAndroidCordova();
|
|
21292
21297
|
}
|
|
21293
21298
|
Object.defineProperty(AppInstallUpgradeCard.prototype, "showUpdateOfflineFeature", {
|
|
21294
21299
|
get: function () {
|
|
@@ -21344,14 +21349,24 @@
|
|
|
21344
21349
|
AppInstallUpgradeCard.prototype.ngOnDestroy = function () {
|
|
21345
21350
|
this._subscription.unsubscribe();
|
|
21346
21351
|
};
|
|
21347
|
-
AppInstallUpgradeCard.prototype.
|
|
21348
|
-
|
|
21349
|
-
return
|
|
21350
|
-
|
|
21351
|
-
|
|
21352
|
-
|
|
21353
|
-
|
|
21354
|
-
|
|
21352
|
+
AppInstallUpgradeCard.prototype.downloadUsingPlatform = function (event, link) {
|
|
21353
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
21354
|
+
return __generator(this, function (_a) {
|
|
21355
|
+
if (!link || !link.url) {
|
|
21356
|
+
console.info('[install-upgrade] Invalid link: ' + JSON.stringify(link));
|
|
21357
|
+
return [2 /*return*/]; // Skip
|
|
21358
|
+
}
|
|
21359
|
+
console.info('[install-upgrade] User ask download of: ' + link.url);
|
|
21360
|
+
this.platform.download({
|
|
21361
|
+
uri: link.url,
|
|
21362
|
+
filename: link.downloadFilename,
|
|
21363
|
+
mimeType: link.mimeType
|
|
21364
|
+
}).then(function (location) {
|
|
21365
|
+
console.info('[install-upgrade] File downloaded at: ' + location);
|
|
21366
|
+
// TODO: display a info toast ?
|
|
21367
|
+
});
|
|
21368
|
+
return [2 /*return*/];
|
|
21369
|
+
});
|
|
21355
21370
|
});
|
|
21356
21371
|
};
|
|
21357
21372
|
AppInstallUpgradeCard.prototype.tryOnline = function () {
|
|
@@ -21477,7 +21492,7 @@
|
|
|
21477
21492
|
AppInstallUpgradeCard.decorators = [
|
|
21478
21493
|
{ type: i0.Component, args: [{
|
|
21479
21494
|
selector: 'app-install-upgrade-card',
|
|
21480
|
-
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 <!-- Waiting spinner -->\n <ng-template #waitingSpinner>\n <ion-spinner *ngIf=\"waitingNetwork\" color=\"light\"></ion-spinner>\n </ng-template>\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 && updateLinks\"\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 updateLinks; 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
|
|
21495
|
+
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 <!-- Waiting spinner -->\n <ng-template #waitingSpinner>\n <ion-spinner *ngIf=\"waitingNetwork\" color=\"light\"></ion-spinner>\n </ng-template>\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 && updateLinks\"\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 updateLinks; 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.downloadFilename; else redirectButton\">\n\n <!-- Download using platform -->\n <ion-button *ngIf=\"platform.canDownload; else webDownloadButton\"\n (click)=\"downloadUsingPlatform($event, asLink(link))\"\n color=\"tertiary\" class=\"ion-float-end\">\n <ion-icon slot=\"start\" name=\"download\"></ion-icon>\n <ion-label translate>COMMON.BTN_DOWNLOAD</ion-label>\n </ion-button>\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",
|
|
21481
21496
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
21482
21497
|
animations: [slideUpDownAnimation],
|
|
21483
21498
|
styles: ["ion-text small{font-size:85%}"]
|
|
@@ -21486,8 +21501,8 @@
|
|
|
21486
21501
|
AppInstallUpgradeCard.ctorParameters = function () { return [
|
|
21487
21502
|
{ type: i1$5.ModalController },
|
|
21488
21503
|
{ type: ConfigService },
|
|
21489
|
-
{ type: PlatformService },
|
|
21490
21504
|
{ type: i0.ChangeDetectorRef },
|
|
21505
|
+
{ type: PlatformService },
|
|
21491
21506
|
{ type: NetworkService },
|
|
21492
21507
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
21493
21508
|
]; };
|