mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Profile picture, notifications, chat romms
This commit is contained in:
@@ -137,9 +137,7 @@ export class NotificationsService {
|
||||
this.active = true
|
||||
console.log('NOtification Listener', notification)
|
||||
this.storenotification(notification)
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
@@ -156,6 +154,7 @@ export class NotificationsService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
storenotification(notification) {
|
||||
console.log('Store Notification ',notification)
|
||||
this.storageService.get("Notifications").then((store) => {
|
||||
@@ -163,22 +162,39 @@ export class NotificationsService {
|
||||
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);
|
||||
if(this.platform.is('mobile')) {
|
||||
|
||||
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('Notification Result',result);
|
||||
this.storageService.store("Notifications", result).then(() => {
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
this.storageService.store("Notifications", store).then(() => {
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.storageService.store("Notifications", result)
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
if (!error) {
|
||||
this.storageService.store("Notifications", [notification])
|
||||
@@ -214,11 +230,9 @@ export class NotificationsService {
|
||||
notification: event.data
|
||||
}
|
||||
|
||||
this.notificatinsRoutes(object)
|
||||
// Implemente a lógica para lidar com a mensagem recebida do Service Worker
|
||||
if (event.data.notificationClicked) {
|
||||
console.log('Notificação push do Firebase clicada em segundo plano!');
|
||||
// Implemente ações adicionais conforme necessário
|
||||
this.notificatinsRoutes(object)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user