@smartsoft001/angular 1.2.35 → 1.2.37

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.
@@ -24,7 +24,7 @@ import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';
24
24
  import { App, Plugins, CameraResultType } from '@capacitor/core';
25
25
  import { __decorate, __metadata } from 'tslib';
26
26
  import { Memoize } from 'lodash-decorators';
27
- import { of, Subject, BehaviorSubject, Subscription, isObservable } from 'rxjs';
27
+ import { of, Subject, BehaviorSubject, Subscription, combineLatest, isObservable } from 'rxjs';
28
28
  import { TableVirtualScrollDataSource } from 'ng-table-virtual-scroll';
29
29
  import * as i1$2 from '@angular/platform-browser';
30
30
  import * as i2$2 from '@angular/router';
@@ -138,6 +138,12 @@ class AuthService {
138
138
  }
139
139
  isAuthenticated() {
140
140
  const token = this.getToken();
141
+ if (!token)
142
+ return false;
143
+ const tokenPayload = decode(token.access_token);
144
+ if (Date.now() >= tokenPayload.exp * 1000) {
145
+ return false;
146
+ }
141
147
  return !!token;
142
148
  }
143
149
  expectPermissions(permissions) {
@@ -2547,7 +2553,9 @@ class MenuService {
2547
2553
  this.resolver = resolver;
2548
2554
  this._openedEnd = false;
2549
2555
  this._menuItemsSource = new BehaviorSubject([]);
2556
+ this._disableSource = new BehaviorSubject(false);
2550
2557
  this.menuItems$ = this._menuItemsSource.asObservable();
2558
+ this.disable$ = this._disableSource.asObservable();
2551
2559
  }
2552
2560
  /**
2553
2561
  * @desc checking if the menu is open (menu on the right side of the screen)
@@ -2555,6 +2563,12 @@ class MenuService {
2555
2563
  get openedEnd() {
2556
2564
  return this._openedEnd;
2557
2565
  }
2566
+ enable() {
2567
+ this._disableSource.next(false);
2568
+ }
2569
+ disable() {
2570
+ this._disableSource.next(true);
2571
+ }
2558
2572
  changeMenuItemByRoute(route, changes) {
2559
2573
  const items = this._menuItemsSource.value.map(i => {
2560
2574
  if (i.route === route)
@@ -2663,9 +2677,12 @@ class AppBaseComponent {
2663
2677
  this._subscriptions.unsubscribe();
2664
2678
  }
2665
2679
  initMenu() {
2666
- this.showMenu$ = this._options.provider.logged$.pipe(map((logged) => {
2667
- return (logged || (this._options.menu && this._options.menu.showForAnonymous));
2668
- }));
2680
+ this.showMenu$ =
2681
+ combineLatest(this._options.provider.logged$, this.menuService.disable$).pipe(map(([logged, disable]) => {
2682
+ if (disable)
2683
+ return false;
2684
+ return (logged || (this._options.menu && this._options.menu.showForAnonymous));
2685
+ }));
2669
2686
  if (this._options.menu) {
2670
2687
  this.menuService.setMenuItems(this._options.menu.items);
2671
2688
  this.menuItems$ = this.menuService.menuItems$;