Firebase web notifications added

This commit is contained in:
Eudes Inácio
2023-06-26 11:12:57 +01:00
parent 2178ad88c2
commit b9bd42e138
11 changed files with 253 additions and 503 deletions
+10 -4
View File
@@ -35,10 +35,16 @@
</div>
<div title="Perfil" class="div-profile cursor-pointer" (click)="openProfile()">
<div *ngIf="this.notificationLength > 0" class="icon-badge">{{notificationLength}}</div>
<!-- <div *ngIf="this.notificationLength > 0" class="icon-badge">{{notificationLength}}</div> -->
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="icon" src='assets/images/theme/doneIt/icons-profile.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon" src='assets/images/icons-profile.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
<div class="profile-text">
<div *ngIf="this.notificationLength > 0" class="icon-badge"
style="right: -18px;top: -29px;">
{{notificationLength}} </div>
</div>
</div>
</div>
@@ -156,9 +162,9 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
<div class="profile-text">
<div *ngIf="this.notificationLength > 0 && !production" class="icon-badge"
style="right: -18px;top: -9px;">
{{notificationLength}}</div>
<div *ngIf="this.notificationLength > 0" class="icon-badge"
style="right: -18px;top: -29px;">
{{notificationLength}} </div>
</div>
</div>
+16 -7
View File
@@ -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) => {