header change

This commit is contained in:
Peter Maquiran
2023-08-31 16:37:11 +01:00
parent 680f57313f
commit c877fe002b
8 changed files with 259 additions and 126 deletions
+30 -21
View File
@@ -13,6 +13,9 @@ import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } fr
import { notificationObject } from '../models/notifications';
import { Capacitor } from '@capacitor/core';
import { AngularFireMessaging } from '@angular/fire/messaging';
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
@Injectable({
providedIn: 'root'
})
@@ -23,6 +26,7 @@ export class NotificationsService {
DataArray = new Array();
callbacks: {
[key: string]: {
type: notificationObject,
@@ -43,7 +47,8 @@ export class NotificationsService {
private router: Router,
private zone: NgZone,
private eventtrigger: EventTrigger,
private afMessaging: AngularFireMessaging,) {
private afMessaging: AngularFireMessaging,
public NotificationHolderService: NotificationHolderService) {
}
@@ -157,33 +162,37 @@ export class NotificationsService {
}
storenotification(notification) {
console.log('Store Notification ',notification)
this.storageService.get("Notifications").then((store) => {
store.push(notification)
console.log('Store Notification ',store)
const result = store.reduce((accumulator, current) => {
let exists = accumulator.find(item => {
return item.id === current.id;
});
if(!exists) {
accumulator = accumulator.concat(current);
}
return accumulator;
}, []);
this.NotificationHolderService.addNotification(notification)
// console.log('Store Notification ',notification)
// this.storageService.get("Notifications").then((store) => {
// store.push(notification)
// console.log('Store Notification ',store)
// const result = store.reduce((accumulator, current) => {
// let exists = accumulator.find(item => {
// return item.id === current.id;
// });
// if(!exists) {
// accumulator = accumulator.concat(current);
// }
// return accumulator;
// }, []);
console.log(result);
// console.log(result);
this.storageService.store("Notifications", result)
}).catch((error) => {
if (!error) {
this.storageService.store("Notifications", [notification])
}
})
// this.storageService.store("Notifications", result)
// }).catch((error) => {
// if (!error) {
// this.storageService.store("Notifications", [notification])
// }
// })
}
onReciveBackground() {