mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Firebase web notifications added
This commit is contained in:
@@ -13,6 +13,7 @@ import { PermissionList } from 'src/app/models/permission/permissionList';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { EventTrigger } from 'src/app/services/eventTrigger.service'
|
||||
import { ActiveTabService } from 'src/app/services/active-tab.service';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@@ -27,7 +28,7 @@ export class HeaderPage implements OnInit {
|
||||
hideSearchBtn: boolean = false;
|
||||
notificationdata: any[] = [];
|
||||
DataArray: Array<object> = [];
|
||||
notificationLength: 0;
|
||||
notificationLength: number = 0;
|
||||
SessionStore = SessionStore
|
||||
check: boolean;
|
||||
|
||||
@@ -36,6 +37,7 @@ export class HeaderPage implements OnInit {
|
||||
canOpenSearch = false
|
||||
showProfileModal = false
|
||||
permissionList = new PermissionList();
|
||||
notificationCount: number = 0;
|
||||
|
||||
|
||||
constructor(
|
||||
@@ -48,7 +50,8 @@ export class HeaderPage implements OnInit {
|
||||
public RouteService: RouteService,
|
||||
public p: PermissionService,
|
||||
private eventTriger: EventTrigger,
|
||||
public ActiveTabService: ActiveTabService
|
||||
public ActiveTabService: ActiveTabService,
|
||||
private notificationService: NotificationsService
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
router.events.subscribe((val) => {
|
||||
@@ -60,22 +63,28 @@ export class HeaderPage implements OnInit {
|
||||
|
||||
this.eventTriger.getObservable().subscribe((event) => {
|
||||
if(event.notification == "recive") {
|
||||
this.notificationLengthData()
|
||||
console.log('header', event.notification)
|
||||
this.notificationLength++
|
||||
} else if(event.notification == "deleted") {
|
||||
console.log('header', event.notification)
|
||||
this.notificationLength--
|
||||
}
|
||||
});
|
||||
|
||||
/* this.notificationService.notificationReceived.subscribe(() => {
|
||||
console.log('header', 'event.notification')
|
||||
this.notificationLengthData()
|
||||
}); */
|
||||
|
||||
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.hideSearch();
|
||||
this.update();
|
||||
this.notificationLengthData();
|
||||
|
||||
}
|
||||
|
||||
update() {
|
||||
|
||||
}
|
||||
|
||||
async notificationLengthData() {
|
||||
await this.storageservice.get("Notifications").then((value) => {
|
||||
|
||||
Reference in New Issue
Block a user