@sumaris-net/ngx-components 2.4.9 → 2.4.11

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.
@@ -18371,9 +18371,11 @@ class PlatformService extends StartableService {
18371
18371
  const checkIntervalMs = (this.environment.checkAppVersionIntervalInSeconds || 0) * 1000;
18372
18372
  if (this.isWeb() && this.environment.production && checkIntervalMs > 0) {
18373
18373
  this.checkAppVersionTimer?.unsubscribe();
18374
- this.checkAppVersionTimer = timer(checkIntervalMs, checkIntervalMs)
18374
+ const subscription = timer(checkIntervalMs, checkIntervalMs)
18375
18375
  .subscribe(_ => this.checkAppVersion({ silent: true, canReload: false /*do NOT auto reload, when app is started*/ }));
18376
- this.registerSubscription(this.checkAppVersionTimer);
18376
+ this.checkAppVersionTimer = subscription;
18377
+ this.registerSubscription(subscription);
18378
+ subscription.add(() => this.unregisterSubscription(subscription));
18377
18379
  }
18378
18380
  }
18379
18381
  catch (err) {
@@ -18594,13 +18596,18 @@ class PlatformService extends StartableService {
18594
18596
  }
18595
18597
  // Ask user to reload
18596
18598
  else {
18599
+ // Stop timer, to avoid infinite loop
18600
+ this.checkAppVersionTimer?.unsubscribe();
18601
+ // Display a reload toast
18597
18602
  await this.showToast({
18598
18603
  message: 'CONFIRM.RELOAD_APP',
18599
18604
  messageParams: { version: remoteVersion, name: this.environment.name },
18600
- type: 'info', duration: -1,
18605
+ type: 'info',
18606
+ duration: -1,
18607
+ showCloseButton: true,
18601
18608
  buttons: [
18602
18609
  // Reload button
18603
- { text: this.translate.instant('COMMON.BTN_RELOAD'),
18610
+ { text: this.translate.instant('COMMON.BTN_UPDATE'),
18604
18611
  side: 'end',
18605
18612
  handler: () => {
18606
18613
  location.href = reloadPath;