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
+6 -1
View File
@@ -192,9 +192,14 @@ export class ProfilePage implements OnInit {
deleteNotification(index) {
this.notificationdata = this.notificationdata.filter(item => item.index != index);
console.log(this.notificationdata)
console.log(this.notificationdata)
this.storageservice.store("Notifications", JSON.stringify(this.notificationdata)).then(() => {
//this.storageservice.remove("Notifications")
this.storageservice.store("Notifications", this.notificationdata).then((store) => {
console.log(store)
this.storageservice.get("Notifications").then((value) => {
console.log(value)
}).catch((error) => {
console.error('storage delete notification: ',error)
})
+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;
}
+6 -1
View File
@@ -11,6 +11,7 @@ import { ThemeService } from '../../services/theme.service';
import { RouteService } from 'src/app/services/route.service';
import { PermissionList } from 'src/app/models/permission/permissionList';
import { PermissionService } from 'src/app/services/permission.service';
/* import { Events } from 'ionic-angular' */
@Component({
selector: 'app-header',
@@ -45,6 +46,7 @@ export class HeaderPage implements OnInit {
public ThemeService: ThemeService,
public RouteService: RouteService,
public p: PermissionService,
/* private eventTriger: Events, */
) {
this.loggeduser = SessionStore.user;
router.events.subscribe((val) => {
@@ -53,7 +55,10 @@ export class HeaderPage implements OnInit {
this.showProfileModal = false
});
/* this.eventTriger.subscribe('notificatioRecive', () => {
this.notificationLengthData();
console.log('Header update with notificatio')
}); */
}