Web notifications added

This commit is contained in:
Eudes Inácio
2021-11-05 15:59:12 +01:00
parent 7378bb3dca
commit 819e8cdac8
5 changed files with 117 additions and 34 deletions
+32 -32
View File
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { AnimationController, ModalController,Platform } from '@ionic/angular';
import { AnimationController, ModalController, Platform } from '@ionic/angular';
import { SearchPage } from 'src/app/pages/search/search.page';
import { Router } from '@angular/router';
import { LoginUserRespose } from 'src/app/models/user.model';
@@ -28,7 +28,7 @@ export class HeaderPage implements OnInit {
SessionStore = SessionStore
production = environment.production
constructor(
private router: Router,
private modalController: ModalController,
@@ -50,39 +50,39 @@ export class HeaderPage implements OnInit {
this.hideSearch();
this.notificationLengthData();
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
this.UpdateNotificationCount();
} else {
this.UpdateNotificationCount();
} */
this.eventrigger.getObservable().subscribe((data)=>{
if(data.notification == "delete" || "recive"){
this.notificationLengthData();
console.log('Deleted notification',data )
}
})
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
this.UpdateNotificationCount();
} else {
this.UpdateNotificationCount();
} */
}
/* UpdateNotificationCount() {
this.notificationsService.registerCallback(
'any',
() => {
setTimeout(()=>{
this.notificationLengthData();
}, 100)
}
)
} */
notificationLengthData() {
ionViewWillEnter() {
this.eventrigger.getObservable().subscribe((data) => {
if (data.notification == "delete" || "recive") {
this.notificationLengthData();
console.log('Deleted notification', data)
}
})
}
/* UpdateNotificationCount() {
this.notificationsService.registerCallback(
'any',
() => {
setTimeout(()=>{
this.notificationLengthData();
}, 100)
}
)
} */
notificationLengthData() {
this.storageservice.get("Notifications").then((value) => {
console.log("Init get store", value)
/* var data = JSON.parse(value); */
/* var data = JSON.parse(value); */
this.notificationLength = value.length;
})
@@ -173,10 +173,10 @@ export class HeaderPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(()=>{
modal.onDidDismiss().then(() => {
this.notificationLengthData()
})
}
async dynamicSearch() {