|
|
@ -8,9 +8,10 @@ import { |
|
|
ChangeDetectorRef, |
|
|
ChangeDetectorRef, |
|
|
Component, |
|
|
Component, |
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
OnDestroy, |
|
|
DestroyRef, |
|
|
OnInit |
|
|
OnInit |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
|
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { MatTabsModule } from '@angular/material/tabs'; |
|
|
import { MatTabsModule } from '@angular/material/tabs'; |
|
|
import { RouterModule } from '@angular/router'; |
|
|
import { RouterModule } from '@angular/router'; |
|
|
import { IonIcon } from '@ionic/angular/standalone'; |
|
|
import { IonIcon } from '@ionic/angular/standalone'; |
|
|
@ -23,8 +24,6 @@ import { |
|
|
readerOutline |
|
|
readerOutline |
|
|
} from 'ionicons/icons'; |
|
|
} from 'ionicons/icons'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { Subject } from 'rxjs'; |
|
|
|
|
|
import { takeUntil } from 'rxjs/operators'; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
host: { class: 'page has-tabs' }, |
|
|
host: { class: 'page has-tabs' }, |
|
|
@ -34,22 +33,21 @@ import { takeUntil } from 'rxjs/operators'; |
|
|
styleUrls: ['./home-page.scss'], |
|
|
styleUrls: ['./home-page.scss'], |
|
|
templateUrl: './home-page.html' |
|
|
templateUrl: './home-page.html' |
|
|
}) |
|
|
}) |
|
|
export class GfHomePageComponent implements OnDestroy, OnInit { |
|
|
export class GfHomePageComponent implements OnInit { |
|
|
public deviceType: string; |
|
|
public deviceType: string; |
|
|
public hasImpersonationId: boolean; |
|
|
public hasImpersonationId: boolean; |
|
|
public tabs: TabConfiguration[] = []; |
|
|
public tabs: TabConfiguration[] = []; |
|
|
public user: User; |
|
|
public user: User; |
|
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
|
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
|
|
|
private destroyRef: DestroyRef, |
|
|
private deviceService: DeviceDetectorService, |
|
|
private deviceService: DeviceDetectorService, |
|
|
private impersonationStorageService: ImpersonationStorageService, |
|
|
private impersonationStorageService: ImpersonationStorageService, |
|
|
private userService: UserService |
|
|
private userService: UserService |
|
|
) { |
|
|
) { |
|
|
this.userService.stateChanged |
|
|
this.userService.stateChanged |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((state) => { |
|
|
.subscribe((state) => { |
|
|
if (state?.user) { |
|
|
if (state?.user) { |
|
|
this.user = state.user; |
|
|
this.user = state.user; |
|
|
@ -110,14 +108,9 @@ export class GfHomePageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
|
this.impersonationStorageService |
|
|
this.impersonationStorageService |
|
|
.onChangeHasImpersonation() |
|
|
.onChangeHasImpersonation() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((impersonationId) => { |
|
|
.subscribe((impersonationId) => { |
|
|
this.hasImpersonationId = !!impersonationId; |
|
|
this.hasImpersonationId = !!impersonationId; |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|