@sumaris-net/ngx-components 2.5.15 → 2.5.16-rc2
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/esm2020/src/app/core/services/platform.service.mjs +14 -13
- package/fesm2015/sumaris-net.ngx-components.mjs +47 -48
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +13 -12
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/platform.service.d.ts +1 -1
|
@@ -18590,7 +18590,7 @@ class PlatformService extends StartableService {
|
|
|
18590
18590
|
// Configure Capacitor plugins
|
|
18591
18591
|
await this.configureCapacitorPlugins();
|
|
18592
18592
|
// Configure translation
|
|
18593
|
-
|
|
18593
|
+
this.configureTranslate();
|
|
18594
18594
|
// Configure cache
|
|
18595
18595
|
this.configureCache();
|
|
18596
18596
|
// Start root services
|
|
@@ -18605,18 +18605,18 @@ class PlatformService extends StartableService {
|
|
|
18605
18605
|
await this.checkAppVersion({ canReload: true });
|
|
18606
18606
|
}
|
|
18607
18607
|
// Update cache configuration when network changed
|
|
18608
|
-
this.networkService.onNetworkStatusChanges
|
|
18608
|
+
this.registerSubscription(this.networkService.onNetworkStatusChanges
|
|
18609
18609
|
.pipe(skip(1) // Already done once, so we skip the first event
|
|
18610
18610
|
)
|
|
18611
|
-
.subscribe(type => this.configureCache(type !== 'none'));
|
|
18611
|
+
.subscribe(type => this.configureCache(type !== 'none')));
|
|
18612
18612
|
console.info(`[platform] Starting platform [OK] {mobile: ${this._mobile}, capacitor: ${this._capacitor}, web: ${this.isWeb()}, downloader: ${this.canDownload}} in ${Date.now() - now}ms`);
|
|
18613
18613
|
// Update authentication type
|
|
18614
|
-
this.configService.config
|
|
18614
|
+
this.registerSubscription(this.configService.config
|
|
18615
18615
|
.pipe(map(config => config?.getProperty(CORE_CONFIG_OPTIONS.AUTH_TOKEN_TYPE)), filter(isNotNilOrBlank), distinctUntilChanged())
|
|
18616
18616
|
.subscribe(tokenType => {
|
|
18617
18617
|
console.info(`[platform] Using auth token type {${tokenType}}`);
|
|
18618
18618
|
this.accountService.tokenType = tokenType;
|
|
18619
|
-
});
|
|
18619
|
+
}));
|
|
18620
18620
|
// Hide the splashscreen (if mobile) - after 1s - and play start sound
|
|
18621
18621
|
if (this._mobile) {
|
|
18622
18622
|
setTimeout(async () => {
|
|
@@ -18753,12 +18753,13 @@ class PlatformService extends StartableService {
|
|
|
18753
18753
|
console.error(`[platform] Error while configuring ${plugin} plugin: ${err.message || err}\n${err?.originalStack || JSON.stringify(err)}`);
|
|
18754
18754
|
}
|
|
18755
18755
|
}
|
|
18756
|
-
|
|
18756
|
+
configureTranslate() {
|
|
18757
18757
|
console.info('[platform] Configuring i18n ...');
|
|
18758
18758
|
// this language will be used as a fallback when a translation isn't found in the current language
|
|
18759
18759
|
this.translate.setDefaultLang(this.environment.defaultLocale);
|
|
18760
|
+
this.dateAdapter.setLocale(this.environment.defaultLocale);
|
|
18760
18761
|
// When locale changes, apply to date adapter
|
|
18761
|
-
this.translate.onLangChange.subscribe(event => {
|
|
18762
|
+
this.registerSubscription(this.translate.onLangChange.subscribe(event => {
|
|
18762
18763
|
if (event && event.lang) {
|
|
18763
18764
|
// force 'en' as 'en_GB'
|
|
18764
18765
|
if (event.lang === 'en') {
|
|
@@ -18777,8 +18778,8 @@ class PlatformService extends StartableService {
|
|
|
18777
18778
|
// Config date adapter
|
|
18778
18779
|
this.dateAdapter.setLocale(locale());
|
|
18779
18780
|
}
|
|
18780
|
-
});
|
|
18781
|
-
this.settings.onChange.subscribe(data => {
|
|
18781
|
+
}));
|
|
18782
|
+
this.registerSubscription(this.settings.onChange.subscribe(data => {
|
|
18782
18783
|
if (data) {
|
|
18783
18784
|
if (data.locale) {
|
|
18784
18785
|
if (data.locale !== this.translate.currentLang) {
|
|
@@ -18791,14 +18792,14 @@ class PlatformService extends StartableService {
|
|
|
18791
18792
|
this.translate.use(this.environment.defaultLocale);
|
|
18792
18793
|
}
|
|
18793
18794
|
}
|
|
18794
|
-
});
|
|
18795
|
+
}));
|
|
18795
18796
|
// Use account's settings, (like locale), when account inheritance enabled
|
|
18796
|
-
this.accountService.onLogin.subscribe(account => {
|
|
18797
|
+
this.registerSubscription(this.accountService.onLogin.subscribe(account => {
|
|
18797
18798
|
if (account.settings && this.settings.settings.accountInheritance) {
|
|
18798
18799
|
const accountSettings = account.settings.asLocalSettings();
|
|
18799
18800
|
this.settings.apply(accountSettings);
|
|
18800
18801
|
}
|
|
18801
|
-
});
|
|
18802
|
+
}));
|
|
18802
18803
|
}
|
|
18803
18804
|
configureCache(online) {
|
|
18804
18805
|
online = toBoolean(online, this.cache.isOnline());
|