mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
header change
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user