|
@@ -1,4 +1,4 @@
|
|
|
-import { Component, HostListener, OnInit } from '@angular/core';
|
|
|
|
|
|
|
+import { Component, HostListener, inject, OnInit } from '@angular/core';
|
|
|
import { ActivatedRoute, Router, RouterModule, RouterOutlet, RoutesRecognized } from '@angular/router';
|
|
import { ActivatedRoute, Router, RouterModule, RouterOutlet, RoutesRecognized } from '@angular/router';
|
|
|
import { MatModule } from '../dependencies/angularlib/mat.module';
|
|
import { MatModule } from '../dependencies/angularlib/mat.module';
|
|
|
import { Angularlib } from 'angularlib/angularlib.module';
|
|
import { Angularlib } from 'angularlib/angularlib.module';
|
|
@@ -10,7 +10,7 @@ import { CommonModule, DatePipe } from '@angular/common';
|
|
|
import { ChangeLanguage } from 'angularlib/labels/label.actions';
|
|
import { ChangeLanguage } from 'angularlib/labels/label.actions';
|
|
|
import { ComponentService } from 'angularlib/component.service';
|
|
import { ComponentService } from 'angularlib/component.service';
|
|
|
import { NotificationModule } from 'angularlib/notification/notification.module';
|
|
import { NotificationModule } from 'angularlib/notification/notification.module';
|
|
|
-import { NOTIFICATION_STATE_TOKEN, NotificationState } from 'angularlib/notification/notification.state';
|
|
|
|
|
|
|
+import { NOTIFICATION_STATE_TOKEN } from 'angularlib/notification/notification.state';
|
|
|
import { Notification } from 'angularlib/notification/notification.actions';
|
|
import { Notification } from 'angularlib/notification/notification.actions';
|
|
|
import { generateId } from 'angularlib/base.service';
|
|
import { generateId } from 'angularlib/base.service';
|
|
|
import { Store } from '@ngxs/store';
|
|
import { Store } from '@ngxs/store';
|
|
@@ -18,9 +18,10 @@ import config from '../config/config.json';
|
|
|
import { UIAuthActions } from 'angularlib/login/state/login.actions';
|
|
import { UIAuthActions } from 'angularlib/login/state/login.actions';
|
|
|
import { Platform } from '@angular/cdk/platform';
|
|
import { Platform } from '@angular/cdk/platform';
|
|
|
import { AppSettingsAction } from 'angularlib/ui.state/ui.state.actions';
|
|
import { AppSettingsAction } from 'angularlib/ui.state/ui.state.actions';
|
|
|
-import { LeaveNotificationDecorator } from './decorators/leave.notification.decorator';
|
|
|
|
|
|
|
+import { PushNotificationDecorator as LeavePushNotif } from 'fis/leave/decorators/push.notification.decorator';
|
|
|
import { FISMessaging } from 'fis/index';
|
|
import { FISMessaging } from 'fis/index';
|
|
|
import { BusinessDataModule } from 'fis/business.data/business.data.module';
|
|
import { BusinessDataModule } from 'fis/business.data/business.data.module';
|
|
|
|
|
+import { NotificationService } from 'angularlib/notification/notification.service';
|
|
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
|
selector: 'app-root',
|
|
selector: 'app-root',
|
|
@@ -68,8 +69,10 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|
|
/**number of notifications */
|
|
/**number of notifications */
|
|
|
protected notificationCount: number = 0;
|
|
protected notificationCount: number = 0;
|
|
|
|
|
|
|
|
- private leaveNotification: LeaveNotificationDecorator<any>;
|
|
|
|
|
- private leaveNotificationSubscription: Subscription;
|
|
|
|
|
|
|
+ private leavePushNotif$: Subscription;
|
|
|
|
|
+
|
|
|
|
|
+ private messaging = inject(FISMessaging);
|
|
|
|
|
+ private notification = inject(NotificationService);
|
|
|
|
|
|
|
|
constructor(
|
|
constructor(
|
|
|
private router: Router,
|
|
private router: Router,
|
|
@@ -82,7 +85,6 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|
|
private platform: Platform
|
|
private platform: Platform
|
|
|
) {
|
|
) {
|
|
|
super(store,cs);
|
|
super(store,cs);
|
|
|
- this.leaveNotification = new LeaveNotificationDecorator(this,{serviceId:'09 - Leave Application'});
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@HostListener('window:mousedown')
|
|
@HostListener('window:mousedown')
|
|
@@ -109,16 +111,17 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|
|
this.loginService.user$.pipe(untilDestroy(this)).subscribe((user:any) => {
|
|
this.loginService.user$.pipe(untilDestroy(this)).subscribe((user:any) => {
|
|
|
if (user?.fisInfo) {
|
|
if (user?.fisInfo) {
|
|
|
this.timeout.pipe(untilDestroy(this),takeUntil(this.loginService.loggedOut)).subscribe();
|
|
this.timeout.pipe(untilDestroy(this),takeUntil(this.loginService.loggedOut)).subscribe();
|
|
|
- if (!this.leaveNotificationSubscription) {
|
|
|
|
|
- this.leaveNotificationSubscription = this.leaveNotification.subscribe({
|
|
|
|
|
- next: async notif => {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (this.leavePushNotif$ === undefined) {
|
|
|
|
|
+ this.leavePushNotif$ = new LeavePushNotif(
|
|
|
|
|
+ this,
|
|
|
|
|
+ this.loginService,
|
|
|
|
|
+ this.messaging,
|
|
|
|
|
+ this.notification
|
|
|
|
|
+ ).subscribe();
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- if (this.leaveNotificationSubscription) this.leaveNotificationSubscription.unsubscribe();
|
|
|
|
|
- this.leaveNotificationSubscription = undefined;
|
|
|
|
|
|
|
+ if (this.leavePushNotif$) this.leavePushNotif$.unsubscribe();
|
|
|
|
|
+ this.leavePushNotif$ = undefined;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|