Notification solved

This commit is contained in:
Eudes Inácio
2022-12-30 15:29:10 +01:00
parent 0c9370d610
commit 6321e6f70a
14507 changed files with 47 additions and 1870405 deletions
+15 -3
View File
@@ -15,6 +15,7 @@ import { v4 as uuidv4 } from 'uuid';
import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service';
import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } from '@capacitor/push-notifications';
/* import { Events } from 'ionic-angular' */
@Injectable({
providedIn: 'root'
@@ -44,6 +45,7 @@ export class NotificationsService {
private activeroute: ActivatedRoute,
private eventtrigger: EventTrigger,
private backgroundservice: BackgroundService,
/* private eventTriger: Events, */
/* private fcm: FCM */) {
this.storageService.get("Notifications").then((value) => {
@@ -147,9 +149,19 @@ export class NotificationsService {
PushNotifications.addListener('pushNotificationReceived',
(notification: PushNotificationSchema) => {
console.log(notification)
this.DataArray.push(notification)
//this.DataArray.push(notification)
//console.log(this.DataArray)
this.storageService.get("Notifications").then((store) => {
store.push(notification)
this.storageService.store("Notifications", store)
}).catch((error) => {
if(!error) {
this.storageService.store("Notifications", [notification])
}
})
this.storageService.store("Notifications", this.DataArray)
/* this.eventTriger.publish('notificatioRecive') */
this.eventtrigger.publishSomeData({
notification: "recive"
})
@@ -172,7 +184,7 @@ export class NotificationsService {
);
}
tempClearArray() {
tempClearArray(data) {
this.DataArray = new Array;
}