Profile picture, notifications, chat romms

This commit is contained in:
Eudes Inácio
2023-09-18 05:41:33 +01:00
parent 540750e0e9
commit 527cc0f2a6
10 changed files with 236 additions and 124 deletions
+33 -19
View File
@@ -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)
}
};
}