@sumaris-net/ngx-components 2.4.8 → 2.4.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/doc/changelog.md +6 -0
- package/esm2020/src/app/core/services/local-settings.service.mjs +8 -3
- package/esm2020/src/app/core/services/platform.service.mjs +12 -5
- package/fesm2015/sumaris-net.ngx-components.mjs +19 -7
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +18 -6
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/local-settings.service.d.ts +8 -3
- package/src/assets/i18n/en-US.json +1 -0
- package/src/assets/i18n/en.json +1 -0
- package/src/assets/i18n/fr.json +2 -1
|
@@ -13322,7 +13322,7 @@ const DEFAULT_SETTINGS = {
|
|
|
13322
13322
|
const APP_LOCAL_SETTINGS = new InjectionToken('DefaultLocalSettings');
|
|
13323
13323
|
const APP_LOCAL_SETTINGS_OPTIONS = new InjectionToken('LocalSettingsOptions');
|
|
13324
13324
|
class LocalSettingsService extends StartableService {
|
|
13325
|
-
constructor(translate, platform, storage, environment, defaultSettings,
|
|
13325
|
+
constructor(translate, platform, storage, environment, defaultSettings, options) {
|
|
13326
13326
|
super(platform);
|
|
13327
13327
|
this.translate = translate;
|
|
13328
13328
|
this.platform = platform;
|
|
@@ -13331,7 +13331,8 @@ class LocalSettingsService extends StartableService {
|
|
|
13331
13331
|
this.defaultSettings = defaultSettings;
|
|
13332
13332
|
this.onChange = new Subject();
|
|
13333
13333
|
this.defaultSettings = { ...DEFAULT_SETTINGS, ...this.defaultSettings };
|
|
13334
|
-
this._optionDefs = Object.values(
|
|
13334
|
+
this._optionDefs = Object.values(options?.options || {});
|
|
13335
|
+
this._serializeAsString = options?.serializeAsString || false;
|
|
13335
13336
|
this.resetData();
|
|
13336
13337
|
this._debug = !environment.production;
|
|
13337
13338
|
if (this._debug)
|
|
@@ -13676,6 +13677,10 @@ class LocalSettingsService extends StartableService {
|
|
|
13676
13677
|
}
|
|
13677
13678
|
else {
|
|
13678
13679
|
console.debug('[settings] Store local settings', this._data);
|
|
13680
|
+
if (this._serializeAsString) {
|
|
13681
|
+
// Fix serialization error, in Sumaris-App
|
|
13682
|
+
return this.storage.set(SETTINGS_STORAGE_KEY, JSON.stringify(this._data));
|
|
13683
|
+
}
|
|
13679
13684
|
return this.storage.set(SETTINGS_STORAGE_KEY, this._data);
|
|
13680
13685
|
}
|
|
13681
13686
|
}
|
|
@@ -18366,9 +18371,11 @@ class PlatformService extends StartableService {
|
|
|
18366
18371
|
const checkIntervalMs = (this.environment.checkAppVersionIntervalInSeconds || 0) * 1000;
|
|
18367
18372
|
if (this.isWeb() && this.environment.production && checkIntervalMs > 0) {
|
|
18368
18373
|
this.checkAppVersionTimer?.unsubscribe();
|
|
18369
|
-
|
|
18374
|
+
const subscription = timer(checkIntervalMs, checkIntervalMs)
|
|
18370
18375
|
.subscribe(_ => this.checkAppVersion({ silent: true, canReload: false /*do NOT auto reload, when app is started*/ }));
|
|
18371
|
-
this.
|
|
18376
|
+
this.checkAppVersionTimer = subscription;
|
|
18377
|
+
this.registerSubscription(subscription);
|
|
18378
|
+
subscription.add(() => this.unregisterSubscription(subscription));
|
|
18372
18379
|
}
|
|
18373
18380
|
}
|
|
18374
18381
|
catch (err) {
|
|
@@ -18589,13 +18596,18 @@ class PlatformService extends StartableService {
|
|
|
18589
18596
|
}
|
|
18590
18597
|
// Ask user to reload
|
|
18591
18598
|
else {
|
|
18599
|
+
// Stop timer, to avoid infinite loop
|
|
18600
|
+
this.checkAppVersionTimer?.unsubscribe();
|
|
18601
|
+
// Display a reload toast
|
|
18592
18602
|
await this.showToast({
|
|
18593
18603
|
message: 'CONFIRM.RELOAD_APP',
|
|
18594
18604
|
messageParams: { version: remoteVersion, name: this.environment.name },
|
|
18595
|
-
type: 'info',
|
|
18605
|
+
type: 'info',
|
|
18606
|
+
duration: -1,
|
|
18607
|
+
showCloseButton: true,
|
|
18596
18608
|
buttons: [
|
|
18597
18609
|
// Reload button
|
|
18598
|
-
{ text: this.translate.instant('COMMON.
|
|
18610
|
+
{ text: this.translate.instant('COMMON.BTN_UPDATE'),
|
|
18599
18611
|
side: 'end',
|
|
18600
18612
|
handler: () => {
|
|
18601
18613
|
location.href = reloadPath;
|