@sumaris-net/ngx-components 1.13.1 → 1.14.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 +243 -51
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +5 -0
- package/esm2015/src/app/core/auth/form/form-auth.js +2 -2
- package/esm2015/src/app/core/install/install-upgrade-card.component.js +3 -3
- package/esm2015/src/app/core/services/account.service.js +1 -3
- package/esm2015/src/app/core/services/base-entity-service.class.js +6 -3
- package/esm2015/src/app/core/services/config/core.config.js +7 -1
- package/esm2015/src/app/core/services/network.service.js +53 -4
- package/esm2015/src/app/core/services/network.utils.js +1 -1
- package/esm2015/src/app/core/services/platform.service.js +91 -5
- package/esm2015/src/app/shared/http/http.utils.js +14 -2
- package/esm2015/src/app/shared/upload-file/upload-file.component.js +12 -7
- package/esm2015/src/app/shared/upload-file/upload-file.model.js +8 -1
- package/esm2015/src/app/shared/version/versions.js +5 -1
- package/esm2015/src/environments/environment.class.js +1 -1
- package/fesm2015/sumaris-net.ngx-components.js +185 -17
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/config/core.config.d.ts +1 -0
- package/src/app/core/services/network.service.d.ts +10 -1
- package/src/app/core/services/network.utils.d.ts +15 -0
- package/src/app/core/services/platform.service.d.ts +6 -0
- package/src/app/shared/http/http.utils.d.ts +1 -0
- package/src/app/shared/upload-file/upload-file.model.d.ts +5 -3
- package/src/app/shared/version/versions.d.ts +2 -0
- package/src/assets/i18n/en-US.json +2 -5
- package/src/assets/i18n/en.json +2 -5
- package/src/assets/i18n/fr.json +4 -3
- package/src/assets/manifest.json +5 -5
- package/src/environments/environment.class.d.ts +1 -0
- package/src/theme/_responsive.scss +7 -3
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/src/assets/manifest.sumaris.json +0 -17
|
@@ -11206,7 +11206,18 @@
|
|
|
11206
11206
|
switch (_a.label) {
|
|
11207
11207
|
case 0:
|
|
11208
11208
|
// Add headers
|
|
11209
|
-
opts = Object.assign({}, opts
|
|
11209
|
+
opts = Object.assign({}, opts
|
|
11210
|
+
//headers: new HttpHeaders(),
|
|
11211
|
+
//.append('X-App-Name', environment.name)
|
|
11212
|
+
//.append('X-App-Version', environment.version),
|
|
11213
|
+
);
|
|
11214
|
+
// Force no cache
|
|
11215
|
+
if (opts.nocache === true) {
|
|
11216
|
+
opts.headers = (opts.headers instanceof i2$1.HttpHeaders ? opts.headers : new i2$1.HttpHeaders(opts.headers));
|
|
11217
|
+
opts.headers
|
|
11218
|
+
.append('Cache-Control', 'no-cache')
|
|
11219
|
+
.append('Pragma', 'no-cache');
|
|
11220
|
+
}
|
|
11210
11221
|
_a.label = 1;
|
|
11211
11222
|
case 1:
|
|
11212
11223
|
_a.trys.push([1, 3, , 4]);
|
|
@@ -11264,6 +11275,7 @@
|
|
|
11264
11275
|
}());
|
|
11265
11276
|
VersionUtils.compare = compareVersionNumbers;
|
|
11266
11277
|
VersionUtils.isCompatible = isVersionCompatible;
|
|
11278
|
+
VersionUtils.isSame = isSameVersion;
|
|
11267
11279
|
/**
|
|
11268
11280
|
* Compare two software version numbers (e.g. 1.7.1)
|
|
11269
11281
|
* Returns:
|
|
@@ -11332,6 +11344,9 @@
|
|
|
11332
11344
|
//console.debug(`[http] Checking actual version {${actualVersion}} is compatible with min expected version {${minVersion}}`);
|
|
11333
11345
|
return compareVersionNumbers(minVersion, actualVersion) <= 0;
|
|
11334
11346
|
}
|
|
11347
|
+
function isSameVersion(v1, v2) {
|
|
11348
|
+
return compareVersionNumbers(v1, v2) === 0;
|
|
11349
|
+
}
|
|
11335
11350
|
|
|
11336
11351
|
var SelectPeerModal = /** @class */ (function () {
|
|
11337
11352
|
function SelectPeerModal(viewCtrl, cd, http, environment) {
|
|
@@ -12470,15 +12485,81 @@
|
|
|
12470
12485
|
});
|
|
12471
12486
|
};
|
|
12472
12487
|
NetworkService.prototype.getNodeInfo = function (peer) {
|
|
12488
|
+
var path = this.computePeerPath(peer, '/api/node/info');
|
|
12489
|
+
return this.get(path);
|
|
12490
|
+
};
|
|
12491
|
+
NetworkService.prototype.getAppManifest = function (peer, opts) {
|
|
12492
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12493
|
+
var path, err_3;
|
|
12494
|
+
return __generator(this, function (_b) {
|
|
12495
|
+
switch (_b.label) {
|
|
12496
|
+
case 0:
|
|
12497
|
+
_b.trys.push([0, 2, , 3]);
|
|
12498
|
+
path = this.computePeerPath(peer, 'manifest.json');
|
|
12499
|
+
if (opts === null || opts === void 0 ? void 0 : opts.nocache) {
|
|
12500
|
+
path += '?t=' + Date.now();
|
|
12501
|
+
}
|
|
12502
|
+
return [4 /*yield*/, this.get(path, opts)];
|
|
12503
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
12504
|
+
case 2:
|
|
12505
|
+
err_3 = _b.sent();
|
|
12506
|
+
if (this.environment.production)
|
|
12507
|
+
console.error('[network] Cannot load file \'manifest.json\'. Please make sure webserver config allow CORS access', err_3);
|
|
12508
|
+
else
|
|
12509
|
+
console.error('[network] Cannot load file \'manifest.json\'.', err_3);
|
|
12510
|
+
return [3 /*break*/, 3];
|
|
12511
|
+
case 3: return [2 /*return*/];
|
|
12512
|
+
}
|
|
12513
|
+
});
|
|
12514
|
+
});
|
|
12515
|
+
};
|
|
12516
|
+
NetworkService.prototype.getAppVersion = function (peer, opts) {
|
|
12517
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12518
|
+
var path, appVersion, err_4, manifest;
|
|
12519
|
+
return __generator(this, function (_b) {
|
|
12520
|
+
switch (_b.label) {
|
|
12521
|
+
case 0:
|
|
12522
|
+
_b.trys.push([0, 2, , 3]);
|
|
12523
|
+
path = this.computePeerPath(peer, 'version.appup');
|
|
12524
|
+
if (opts === null || opts === void 0 ? void 0 : opts.nocache) {
|
|
12525
|
+
path += '?t=' + Date.now();
|
|
12526
|
+
}
|
|
12527
|
+
return [4 /*yield*/, this.get(path, opts)];
|
|
12528
|
+
case 1:
|
|
12529
|
+
appVersion = _b.sent();
|
|
12530
|
+
if (isNotNilOrBlank(appVersion))
|
|
12531
|
+
return [2 /*return*/, appVersion];
|
|
12532
|
+
return [3 /*break*/, 3];
|
|
12533
|
+
case 2:
|
|
12534
|
+
err_4 = _b.sent();
|
|
12535
|
+
if (this.environment.production)
|
|
12536
|
+
console.error('[network] Cannot load file \'version.appup\'. Please make sure webserver config allow CORS access');
|
|
12537
|
+
else
|
|
12538
|
+
console.error('[network] Cannot load file \'version.appup\'.', err_4);
|
|
12539
|
+
return [3 /*break*/, 3];
|
|
12540
|
+
case 3: return [4 /*yield*/, this.getAppManifest(peer, opts)];
|
|
12541
|
+
case 4:
|
|
12542
|
+
manifest = _b.sent();
|
|
12543
|
+
return [2 /*return*/, manifest === null || manifest === void 0 ? void 0 : manifest.version];
|
|
12544
|
+
}
|
|
12545
|
+
});
|
|
12546
|
+
});
|
|
12547
|
+
};
|
|
12548
|
+
NetworkService.prototype.computePeerPath = function (peer, path) {
|
|
12473
12549
|
peer = peer || this.peer;
|
|
12474
12550
|
if (!peer)
|
|
12475
12551
|
return undefined;
|
|
12476
|
-
var peerUrl =
|
|
12552
|
+
var peerUrl = (peer instanceof exports.Peer) ? peer.url : peer;
|
|
12477
12553
|
// Remove trailing slash
|
|
12478
12554
|
if (peerUrl.endsWith('/')) {
|
|
12479
12555
|
peerUrl = peerUrl.substr(0, peerUrl.length - 1);
|
|
12480
12556
|
}
|
|
12481
|
-
|
|
12557
|
+
// Add first path
|
|
12558
|
+
if (!path.startsWith('/')) {
|
|
12559
|
+
path = '/' + path;
|
|
12560
|
+
}
|
|
12561
|
+
// Concat peer URL and path
|
|
12562
|
+
return peerUrl + path;
|
|
12482
12563
|
};
|
|
12483
12564
|
/**
|
|
12484
12565
|
* Allow to force offline mode
|
|
@@ -15860,8 +15941,6 @@
|
|
|
15860
15941
|
};
|
|
15861
15942
|
AccountService.prototype.canUserWriteDataForDepartment = function (recorderDepartment) {
|
|
15862
15943
|
if (ReferentialUtils.isEmpty(recorderDepartment)) {
|
|
15863
|
-
if (!this.isAdmin())
|
|
15864
|
-
console.warn('Unable to check if user has right: invalid recorderDepartment', recorderDepartment);
|
|
15865
15944
|
return this.isAdmin();
|
|
15866
15945
|
}
|
|
15867
15946
|
// Should be login, and status ENABLE
|
|
@@ -17167,6 +17246,12 @@
|
|
|
17167
17246
|
key: 'sumaris.android.install.url',
|
|
17168
17247
|
label: 'CONFIGURATION.OPTIONS.ANDROID_INSTALL_URL',
|
|
17169
17248
|
type: 'string'
|
|
17249
|
+
},
|
|
17250
|
+
DB_TIMEZONE: {
|
|
17251
|
+
key: 'sumaris.persistence.db.timezone',
|
|
17252
|
+
label: 'DB Timezone (readonly)',
|
|
17253
|
+
type: 'string',
|
|
17254
|
+
isTransient: true // ONly on server, cannot be set
|
|
17170
17255
|
}
|
|
17171
17256
|
});
|
|
17172
17257
|
|
|
@@ -17632,6 +17717,9 @@
|
|
|
17632
17717
|
PlatformService.prototype.isApp = function () {
|
|
17633
17718
|
return this._cordova && (this._android || this._ios);
|
|
17634
17719
|
};
|
|
17720
|
+
PlatformService.prototype.isMobileWeb = function () {
|
|
17721
|
+
return isMobile(window) && this.isWeb();
|
|
17722
|
+
};
|
|
17635
17723
|
Object.defineProperty(PlatformService.prototype, "canDownload", {
|
|
17636
17724
|
get: function () {
|
|
17637
17725
|
return !!this.downloader && this.isAndroidCordova();
|
|
@@ -17653,18 +17741,19 @@
|
|
|
17653
17741
|
return this.platform.height();
|
|
17654
17742
|
};
|
|
17655
17743
|
PlatformService.prototype.ngOnStart = function () {
|
|
17744
|
+
var _a;
|
|
17656
17745
|
return __awaiter(this, void 0, void 0, function () {
|
|
17657
|
-
var now, storage, err_1;
|
|
17746
|
+
var now, storage, checkIntervalMs, err_1;
|
|
17658
17747
|
var _this = this;
|
|
17659
|
-
return __generator(this, function (
|
|
17660
|
-
switch (
|
|
17748
|
+
return __generator(this, function (_d) {
|
|
17749
|
+
switch (_d.label) {
|
|
17661
17750
|
case 0:
|
|
17662
17751
|
now = Date.now();
|
|
17663
17752
|
this.accountService.tokenType = undefined;
|
|
17664
17753
|
console.info('[platform] Starting platform...');
|
|
17665
|
-
|
|
17754
|
+
_d.label = 1;
|
|
17666
17755
|
case 1:
|
|
17667
|
-
|
|
17756
|
+
_d.trys.push([1, 8, , 9]);
|
|
17668
17757
|
this._mobile = this.is('mobile');
|
|
17669
17758
|
this._cordova = this.is('cordova');
|
|
17670
17759
|
this._android = this.is('android');
|
|
@@ -17676,13 +17765,13 @@
|
|
|
17676
17765
|
return [4 /*yield*/, this.configureTranslate()];
|
|
17677
17766
|
case 2:
|
|
17678
17767
|
// Configure translation
|
|
17679
|
-
|
|
17768
|
+
_d.sent();
|
|
17680
17769
|
return [4 /*yield*/, this.storageReady()];
|
|
17681
17770
|
case 3:
|
|
17682
|
-
storage =
|
|
17771
|
+
storage = _d.sent();
|
|
17683
17772
|
return [4 /*yield*/, this.migrateStorage(storage)];
|
|
17684
17773
|
case 4:
|
|
17685
|
-
|
|
17774
|
+
_d.sent();
|
|
17686
17775
|
// Start root services
|
|
17687
17776
|
return [4 /*yield*/, Promise.all([
|
|
17688
17777
|
this.entitiesStorage.ready(),
|
|
@@ -17693,12 +17782,19 @@
|
|
|
17693
17782
|
])];
|
|
17694
17783
|
case 5:
|
|
17695
17784
|
// Start root services
|
|
17696
|
-
|
|
17697
|
-
|
|
17785
|
+
_d.sent();
|
|
17786
|
+
if (!(this.isWeb() && this.environment.production)) return [3 /*break*/, 7];
|
|
17787
|
+
return [4 /*yield*/, this.checkAppVersion({ canReload: true })];
|
|
17788
|
+
case 6:
|
|
17789
|
+
_d.sent();
|
|
17790
|
+
_d.label = 7;
|
|
17791
|
+
case 7:
|
|
17698
17792
|
// Update cache configuration when network changed
|
|
17699
17793
|
this.networkService.onNetworkStatusChanges
|
|
17700
|
-
.pipe(operators.skip(1)
|
|
17794
|
+
.pipe(operators.skip(1) // Olready done once, so we skip the first event
|
|
17795
|
+
)
|
|
17701
17796
|
.subscribe(function (type) { return _this.configureCache(type !== 'none'); });
|
|
17797
|
+
console.info("[platform] Starting platform [OK] {mobile: " + this._mobile + ", web: " + this.isWeb() + ", downloader: " + this.canDownload + ", fileOpener: " + this.canOpenFile + "} in " + (Date.now() - now) + "ms");
|
|
17702
17798
|
// Update authentication type
|
|
17703
17799
|
this.configService.config
|
|
17704
17800
|
.pipe(operators.map(function (config) { return config === null || config === void 0 ? void 0 : config.getProperty(CORE_CONFIG_OPTIONS.AUTH_TOKEN_TYPE); }), operators.filter(isNotNilOrBlank), operators.distinctUntilChanged())
|
|
@@ -17715,12 +17811,19 @@
|
|
|
17715
17811
|
_this.audioProvider.playStartupSound();
|
|
17716
17812
|
}, 1000);
|
|
17717
17813
|
}
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
|
|
17814
|
+
checkIntervalMs = (this.environment.checkAppVersionIntervalInSeconds || 0) * 1000;
|
|
17815
|
+
if (this.isWeb() && this.environment.production && checkIntervalMs > 0) {
|
|
17816
|
+
(_a = this.checkAppVersionTimer) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
17817
|
+
this.checkAppVersionTimer = rxjs.timer(checkIntervalMs, checkIntervalMs)
|
|
17818
|
+
.subscribe(function (_) { return _this.checkAppVersion({ silent: true, canReload: false /*do NOT auto reload, when app is started*/ }); });
|
|
17819
|
+
this.registerSubscription(this.checkAppVersionTimer);
|
|
17820
|
+
}
|
|
17821
|
+
return [3 /*break*/, 9];
|
|
17822
|
+
case 8:
|
|
17823
|
+
err_1 = _d.sent();
|
|
17721
17824
|
// Manage startup error
|
|
17722
17825
|
return [2 /*return*/, this.onStartupError(err_1)];
|
|
17723
|
-
case
|
|
17826
|
+
case 9: return [2 /*return*/];
|
|
17724
17827
|
}
|
|
17725
17828
|
});
|
|
17726
17829
|
});
|
|
@@ -17841,16 +17944,89 @@
|
|
|
17841
17944
|
this.cache.setDefaultTTL(cacheTTL);
|
|
17842
17945
|
this.cache.setOfflineInvalidate(false); // Do not invalidate cache when offline
|
|
17843
17946
|
};
|
|
17947
|
+
PlatformService.prototype.checkAppVersion = function (opts) {
|
|
17948
|
+
var _a, _b, _c;
|
|
17949
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
17950
|
+
var silent, production, canAutoReload, actualVersion, peer, remoteVersion, reloadPath;
|
|
17951
|
+
return __generator(this, function (_d) {
|
|
17952
|
+
switch (_d.label) {
|
|
17953
|
+
case 0:
|
|
17954
|
+
if (this.networkService.offline || !this.isWeb())
|
|
17955
|
+
return [2 /*return*/]; // Skip
|
|
17956
|
+
silent = (opts === null || opts === void 0 ? void 0 : opts.silent) === true;
|
|
17957
|
+
production = this.environment.production;
|
|
17958
|
+
canAutoReload = !opts || opts.canReload !== false;
|
|
17959
|
+
if (!silent)
|
|
17960
|
+
console.info('[platform] Checking remote app version...');
|
|
17961
|
+
actualVersion = this.environment.version;
|
|
17962
|
+
if (isNilOrBlank(actualVersion)) {
|
|
17963
|
+
console.error('[platform] Missing required value for \'environment.version\'. Cannot check remote app version.');
|
|
17964
|
+
(_a = this.checkAppVersionTimer) === null || _a === void 0 ? void 0 : _a.unsubscribe(); // Stop timer if exists
|
|
17965
|
+
return [2 /*return*/]; // Skip
|
|
17966
|
+
}
|
|
17967
|
+
peer = undefined;
|
|
17968
|
+
return [4 /*yield*/, this.networkService.getAppVersion(peer)];
|
|
17969
|
+
case 1:
|
|
17970
|
+
remoteVersion = _d.sent();
|
|
17971
|
+
if (isNilOrBlank(remoteVersion)) {
|
|
17972
|
+
if (production && !silent)
|
|
17973
|
+
console.error('[platform] Cannot load remote app version. Skipping version check');
|
|
17974
|
+
(_b = this.checkAppVersionTimer) === null || _b === void 0 ? void 0 : _b.unsubscribe(); // Stop timer if exists
|
|
17975
|
+
return [2 /*return*/];
|
|
17976
|
+
}
|
|
17977
|
+
if (VersionUtils.isCompatible(remoteVersion, actualVersion)) {
|
|
17978
|
+
if (!silent)
|
|
17979
|
+
console.info('[platform] Checking remote app version [OK]');
|
|
17980
|
+
return [2 /*return*/];
|
|
17981
|
+
}
|
|
17982
|
+
reloadPath = location.href.replace(/[&]?version=[0-9.]+/gi, '');
|
|
17983
|
+
reloadPath += (reloadPath.indexOf('?') === -1) ? '?' : '&'; // Add query param separator
|
|
17984
|
+
reloadPath += 'version=' + remoteVersion; // Add version (to avoid a reload infinite loop)
|
|
17985
|
+
// Already try to reload, but version still bad
|
|
17986
|
+
if (reloadPath === location.href) {
|
|
17987
|
+
if (canAutoReload)
|
|
17988
|
+
console.error("[platform] Reloaded page failed, because version still mismatch! Please check version.appup file (expected app version: " + actualVersion + ")");
|
|
17989
|
+
// Stop timer, to avoid infinite loop
|
|
17990
|
+
(_c = this.checkAppVersionTimer) === null || _c === void 0 ? void 0 : _c.unsubscribe();
|
|
17991
|
+
return [2 /*return*/];
|
|
17992
|
+
}
|
|
17993
|
+
console.warn("[platform] More recent version detected (remote: " + remoteVersion + ", actual: " + actualVersion);
|
|
17994
|
+
if (!canAutoReload) return [3 /*break*/, 2];
|
|
17995
|
+
console.info('[platform] Will reloading at ' + reloadPath);
|
|
17996
|
+
location.href = reloadPath;
|
|
17997
|
+
return [3 /*break*/, 4];
|
|
17998
|
+
case 2: return [4 /*yield*/, this.showToast({
|
|
17999
|
+
message: 'CONFIRM.RELOAD_APP',
|
|
18000
|
+
messageParams: { version: remoteVersion, name: this.environment.name },
|
|
18001
|
+
type: 'info', duration: -1,
|
|
18002
|
+
buttons: [
|
|
18003
|
+
// Reload button
|
|
18004
|
+
{ text: this.translate.instant('COMMON.BTN_RELOAD'),
|
|
18005
|
+
side: 'end', handler: function () {
|
|
18006
|
+
location.href = reloadPath;
|
|
18007
|
+
return true;
|
|
18008
|
+
}
|
|
18009
|
+
}
|
|
18010
|
+
]
|
|
18011
|
+
})];
|
|
18012
|
+
case 3:
|
|
18013
|
+
_d.sent();
|
|
18014
|
+
_d.label = 4;
|
|
18015
|
+
case 4: return [2 /*return*/];
|
|
18016
|
+
}
|
|
18017
|
+
});
|
|
18018
|
+
});
|
|
18019
|
+
};
|
|
17844
18020
|
PlatformService.prototype.storageReady = function () {
|
|
17845
18021
|
return __awaiter(this, void 0, void 0, function () {
|
|
17846
18022
|
var forage, driver;
|
|
17847
|
-
return __generator(this, function (
|
|
17848
|
-
switch (
|
|
18023
|
+
return __generator(this, function (_d) {
|
|
18024
|
+
switch (_d.label) {
|
|
17849
18025
|
case 0:
|
|
17850
18026
|
console.info("[platform] Starting storage...");
|
|
17851
18027
|
return [4 /*yield*/, this.storage.ready()];
|
|
17852
18028
|
case 1:
|
|
17853
|
-
forage =
|
|
18029
|
+
forage = _d.sent();
|
|
17854
18030
|
driver = forage.driver();
|
|
17855
18031
|
if (isNil(driver)) {
|
|
17856
18032
|
console.error('[platform] NO DRIVER DEFINED IN STORAGE. Local storage cannot be used !');
|
|
@@ -17866,8 +18042,8 @@
|
|
|
17866
18042
|
PlatformService.prototype.migrateStorage = function (storage) {
|
|
17867
18043
|
return __awaiter(this, void 0, void 0, function () {
|
|
17868
18044
|
var canMigrate, oldForage, keys, now, toast_1, duration, err_2;
|
|
17869
|
-
return __generator(this, function (
|
|
17870
|
-
switch (
|
|
18045
|
+
return __generator(this, function (_d) {
|
|
18046
|
+
switch (_d.label) {
|
|
17871
18047
|
case 0:
|
|
17872
18048
|
canMigrate = storage &&
|
|
17873
18049
|
((storage.driver() === 'cordovaSQLiteDriver' && (storage.supports(storage.INDEXEDDB) || storage.supports(storage.WEBSQL))) ||
|
|
@@ -17881,26 +18057,26 @@
|
|
|
17881
18057
|
});
|
|
17882
18058
|
return [4 /*yield*/, oldForage.keys()];
|
|
17883
18059
|
case 1:
|
|
17884
|
-
keys =
|
|
18060
|
+
keys = _d.sent();
|
|
17885
18061
|
if (!isEmptyArray(keys)) return [3 /*break*/, 3];
|
|
17886
18062
|
// Drop the old instance (not need anymore)
|
|
17887
18063
|
console.debug("[platform] Old storage is empty: dropping unused instance {name: '" + storage.config().name + "', driver: '" + oldForage.driver() + "'}");
|
|
17888
18064
|
return [4 /*yield*/, oldForage.dropInstance()];
|
|
17889
18065
|
case 2:
|
|
17890
|
-
|
|
18066
|
+
_d.sent();
|
|
17891
18067
|
return [3 /*break*/, 12];
|
|
17892
18068
|
case 3:
|
|
17893
18069
|
now = Date.now();
|
|
17894
18070
|
console.info("[platform] Starting storage migration...");
|
|
17895
18071
|
return [4 /*yield*/, this.showToast({ message: 'INFO.DATA_MIGRATION_STARTED', type: 'info', duration: 30000 })];
|
|
17896
18072
|
case 4:
|
|
17897
|
-
toast_1 =
|
|
17898
|
-
|
|
18073
|
+
toast_1 = _d.sent();
|
|
18074
|
+
_d.label = 5;
|
|
17899
18075
|
case 5:
|
|
17900
|
-
|
|
18076
|
+
_d.trys.push([5, 9, , 12]);
|
|
17901
18077
|
return [4 /*yield*/, StorageUtils.copy(oldForage, storage, { keys: keys, deleteAfterCopy: false })];
|
|
17902
18078
|
case 6:
|
|
17903
|
-
|
|
18079
|
+
_d.sent();
|
|
17904
18080
|
duration = Date.now() - now;
|
|
17905
18081
|
setTimeout(function () { return toast_1.dismiss(); }, Math.max(2000 - duration, 0));
|
|
17906
18082
|
return [4 /*yield*/, this.showToast({ message: 'INFO.DATA_MIGRATION_SUCCEED',
|
|
@@ -17908,26 +18084,26 @@
|
|
|
17908
18084
|
showCloseButton: true
|
|
17909
18085
|
})];
|
|
17910
18086
|
case 7:
|
|
17911
|
-
|
|
18087
|
+
_d.sent();
|
|
17912
18088
|
console.info('[platform] Starting storage migration [OK]');
|
|
17913
18089
|
// Drop the old instance
|
|
17914
18090
|
console.info("[platform] Drop old storage {name: '" + storage.config().name + "', driver: '" + oldForage.driver() + "'}");
|
|
17915
18091
|
return [4 /*yield*/, oldForage.dropInstance()];
|
|
17916
18092
|
case 8:
|
|
17917
|
-
|
|
18093
|
+
_d.sent();
|
|
17918
18094
|
return [3 /*break*/, 12];
|
|
17919
18095
|
case 9:
|
|
17920
|
-
err_2 =
|
|
18096
|
+
err_2 = _d.sent();
|
|
17921
18097
|
console.error(err_2 && err_2.message || err_2, err_2);
|
|
17922
18098
|
return [4 /*yield*/, toast_1.dismiss()];
|
|
17923
18099
|
case 10:
|
|
17924
|
-
|
|
18100
|
+
_d.sent();
|
|
17925
18101
|
return [4 /*yield*/, this.showToast({ message: 'ERROR.DATA_MIGRATION_FAILED',
|
|
17926
18102
|
type: 'error',
|
|
17927
18103
|
showCloseButton: true
|
|
17928
18104
|
})];
|
|
17929
18105
|
case 11:
|
|
17930
|
-
|
|
18106
|
+
_d.sent();
|
|
17931
18107
|
return [3 /*break*/, 12];
|
|
17932
18108
|
case 12: return [2 /*return*/];
|
|
17933
18109
|
}
|
|
@@ -17943,8 +18119,8 @@
|
|
|
17943
18119
|
PlatformService.prototype.onStartupError = function (err) {
|
|
17944
18120
|
return __awaiter(this, void 0, void 0, function () {
|
|
17945
18121
|
var message, detailsMessage;
|
|
17946
|
-
return __generator(this, function (
|
|
17947
|
-
switch (
|
|
18122
|
+
return __generator(this, function (_d) {
|
|
18123
|
+
switch (_d.label) {
|
|
17948
18124
|
case 0:
|
|
17949
18125
|
console.error('[platform] Failed starting the platform! ', err);
|
|
17950
18126
|
message = err && err.message || err;
|
|
@@ -17956,14 +18132,14 @@
|
|
|
17956
18132
|
if (!this.translate) return [3 /*break*/, 2];
|
|
17957
18133
|
return [4 /*yield*/, this.translate.get(message).toPromise()];
|
|
17958
18134
|
case 1:
|
|
17959
|
-
message =
|
|
18135
|
+
message = _d.sent();
|
|
17960
18136
|
if (err && err.code) {
|
|
17961
18137
|
message += " {code: " + err.code + "}";
|
|
17962
18138
|
}
|
|
17963
18139
|
return [3 /*break*/, 3];
|
|
17964
18140
|
case 2:
|
|
17965
18141
|
message = "Fatal error: Please contact your administrator.\n\n{code: " + (err && err.code || 'null') + ", message: \"" + message + "\"}";
|
|
17966
|
-
|
|
18142
|
+
_d.label = 3;
|
|
17967
18143
|
case 3:
|
|
17968
18144
|
if (!this.toastController) return [3 /*break*/, 5];
|
|
17969
18145
|
if (detailsMessage) {
|
|
@@ -17976,7 +18152,7 @@
|
|
|
17976
18152
|
message: message
|
|
17977
18153
|
})];
|
|
17978
18154
|
case 4:
|
|
17979
|
-
|
|
18155
|
+
_d.sent();
|
|
17980
18156
|
return [3 /*break*/, 6];
|
|
17981
18157
|
case 5:
|
|
17982
18158
|
if (window) {
|
|
@@ -17990,7 +18166,7 @@
|
|
|
17990
18166
|
if (err && err.details)
|
|
17991
18167
|
console.error('cause', err.details);
|
|
17992
18168
|
}
|
|
17993
|
-
|
|
18169
|
+
_d.label = 6;
|
|
17994
18170
|
case 6: return [2 /*return*/];
|
|
17995
18171
|
}
|
|
17996
18172
|
});
|
|
@@ -18120,6 +18296,13 @@
|
|
|
18120
18296
|
}
|
|
18121
18297
|
return FileResponse;
|
|
18122
18298
|
}());
|
|
18299
|
+
function isProgressEvent(event) {
|
|
18300
|
+
return event.type === i2$1.HttpEventType.UploadProgress
|
|
18301
|
+
|| event.type === i2$1.HttpEventType.DownloadProgress;
|
|
18302
|
+
}
|
|
18303
|
+
function isResponseEvent(event) {
|
|
18304
|
+
return event.type === i2$1.HttpEventType.Response;
|
|
18305
|
+
}
|
|
18123
18306
|
|
|
18124
18307
|
var UploadFileComponent = /** @class */ (function () {
|
|
18125
18308
|
function UploadFileComponent(cd, translate) {
|
|
@@ -18286,7 +18469,7 @@
|
|
|
18286
18469
|
operators.switchMap(function (file) { return _this.uploadFn(file)
|
|
18287
18470
|
.pipe(operators.map(function (event) {
|
|
18288
18471
|
// Progress event
|
|
18289
|
-
if ((event
|
|
18472
|
+
if (isProgressEvent(event)) {
|
|
18290
18473
|
if (isNotNil(event.loaded) && event.loaded >= 0) {
|
|
18291
18474
|
file.progress = Math.min(1, event.loaded / (event.total || 1));
|
|
18292
18475
|
}
|
|
@@ -18294,15 +18477,20 @@
|
|
|
18294
18477
|
file.progress = -1; // Indeterminate progression
|
|
18295
18478
|
}
|
|
18296
18479
|
}
|
|
18480
|
+
// User event
|
|
18481
|
+
else if (event.type === i2$1.HttpEventType.User) {
|
|
18482
|
+
file.progress = -1; // Indeterminate progression
|
|
18483
|
+
}
|
|
18297
18484
|
// Response event
|
|
18298
|
-
else if (event
|
|
18485
|
+
else if (isResponseEvent(event)) {
|
|
18299
18486
|
file.progress = 1;
|
|
18300
18487
|
file.response = event;
|
|
18301
18488
|
console.debug("[upload-file] " + file.name + ": " + (event.statusText || 'OK'), file.response);
|
|
18302
18489
|
}
|
|
18303
|
-
// Other events
|
|
18490
|
+
// Other events: ignore
|
|
18304
18491
|
else {
|
|
18305
|
-
|
|
18492
|
+
// DEBUG
|
|
18493
|
+
console.debug('[upload-file] Ignoring a file event: ', event);
|
|
18306
18494
|
}
|
|
18307
18495
|
return file;
|
|
18308
18496
|
}), operators.catchError(function (err) {
|
|
@@ -20467,7 +20655,7 @@
|
|
|
20467
20655
|
_this.showPwd = false;
|
|
20468
20656
|
_this.onCancel = new i0.EventEmitter();
|
|
20469
20657
|
_this.onSubmit = new i0.EventEmitter();
|
|
20470
|
-
_this.mobile =
|
|
20658
|
+
_this.mobile = settings.mobile;
|
|
20471
20659
|
_this.canWorkOffline = _this.settings.hasOfflineFeature();
|
|
20472
20660
|
_this._enable = true;
|
|
20473
20661
|
return _this;
|
|
@@ -22925,10 +23113,10 @@
|
|
|
22925
23113
|
};
|
|
22926
23114
|
AppInstallUpgradeCard.prototype.getCompatibleInstallLinks = function (installLinks) {
|
|
22927
23115
|
// Cordova already running: not need to install
|
|
22928
|
-
if (this.platform.
|
|
23116
|
+
if (this.platform.isCordova())
|
|
22929
23117
|
return undefined;
|
|
22930
23118
|
// If mobile web: return all
|
|
22931
|
-
if (this.platform.
|
|
23119
|
+
if (this.platform.isMobileWeb()) {
|
|
22932
23120
|
return installLinks;
|
|
22933
23121
|
}
|
|
22934
23122
|
return undefined;
|
|
@@ -24312,8 +24500,10 @@
|
|
|
24312
24500
|
var _this = this;
|
|
24313
24501
|
if (isNil(id))
|
|
24314
24502
|
throw Error('Missing argument \'id\' ');
|
|
24315
|
-
if (!this.subscriptions.listenChanges)
|
|
24316
|
-
|
|
24503
|
+
if (!this.subscriptions.listenChanges) {
|
|
24504
|
+
console.warn(this.constructor.name + ".listenChanges() not implemented yet. Will empty observable");
|
|
24505
|
+
return rxjs.of();
|
|
24506
|
+
}
|
|
24317
24507
|
var variables = opts && opts.variables || {
|
|
24318
24508
|
id: id,
|
|
24319
24509
|
interval: toNumber(opts && opts.interval, 0) // no timer by default
|
|
@@ -31131,6 +31321,8 @@
|
|
|
31131
31321
|
exports.isNotNilString = isNotNilString;
|
|
31132
31322
|
exports.isNumber = isNumber;
|
|
31133
31323
|
exports.isNumberRange = isNumberRange;
|
|
31324
|
+
exports.isProgressEvent = isProgressEvent;
|
|
31325
|
+
exports.isResponseEvent = isResponseEvent;
|
|
31134
31326
|
exports.isTouchUi = isTouchUi;
|
|
31135
31327
|
exports.isWindow = isWindow;
|
|
31136
31328
|
exports.joinProperties = joinProperties;
|