diff --git a/config.xml b/config.xml
index 97d2fb38d..7b18d7926 100644
--- a/config.xml
+++ b/config.xml
@@ -3,7 +3,7 @@
gabinete digital
An awesome Ionic/Cordova app.
Ionic Framework Team
-
+
diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts
index 0764e07fc..bd503f4ac 100644
--- a/src/app/modals/profile/profile.page.ts
+++ b/src/app/modals/profile/profile.page.ts
@@ -69,9 +69,12 @@ export class ProfilePage implements OnInit {
this.storageservice.get("Notifications").then((value) => {
console.log("Init get store", value)
- var data = JSON.parse(value);
- console.log("Init store parse", data)
- data.forEach((element,i) => {
+ /* var data = JSON.parse(value); */
+ console.log("Init store parse", value)
+ if(typeof(value) == 'string') {
+ value = JSON.stringify(value)
+ }
+ value.forEach((element,i) => {
console.log("ARaaAA", element)
let notificationObject;
if(element.payload){
@@ -121,17 +124,6 @@ export class ProfilePage implements OnInit {
console.log('Timer badge count')
}
- typeAgendaColor(service,typeagenda,role){
- if (service == "agenda" && typeagenda == "oficial" && role == "100000011"){
- document.body.style.setProperty(`--notificationtypeagenda`, "#ffb703");
- } else if( service == "agenda" && typeagenda == "pessoal" && role == "100000011"){
- document.body.style.setProperty(`--notificationtypeagenda`, "#ff0303");
- } else if (service == "agenda" && typeagenda == "oficial" && role == "100000014"){
- document.body.style.setProperty(`--notificationtypeagenda`, "#03d838");
- } else if (service == "agenda" && typeagenda == "oficial" && role == "100000014"){
- document.body.style.setProperty(`--notificationtypeagenda`, "#8b0ae0");
- }
- }
getFormatedTime(dateString){
var date = new Date(dateString);
diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts
index 924242563..57df9a5e7 100644
--- a/src/app/services/notifications.service.ts
+++ b/src/app/services/notifications.service.ts
@@ -212,7 +212,7 @@ export class NotificationsService {
//this.jsonstore.createCollection('Notifications',message);
this.DataArray.push(message)
console.log("On ReceiveNotification", this.DataArray)
- this.storageService.store("Notifications",JSON.stringify(this.DataArray))
+ this.storageService.store("Notifications",this.DataArray)
console.log(message);
var data = JSON.parse(message.payload);
@@ -229,7 +229,7 @@ export class NotificationsService {
}
this.callbacks.forEach( e=> {
- if(e.type == data.Object) {
+ if(e.type == data.Object || e.type == "any") {
e.funx()
}
})
diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts
index 19172c015..c935f1c4b 100644
--- a/src/app/shared/header/header.page.ts
+++ b/src/app/shared/header/header.page.ts
@@ -6,6 +6,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { ProfilePage } from 'src/app/modals/profile/profile.page';
import { StorageService } from '../../services/storage.service';
import { SessionStore } from 'src/app/store/session.service';
+import { NotificationsService } from '../../services/notifications.service';
@Component({
selector: 'app-header',
@@ -29,6 +30,7 @@ export class HeaderPage implements OnInit {
private animationController: AnimationController,
private storageservice: StorageService,
private platform: Platform,
+ private notificationsService: NotificationsService,
) {
this.loggeduser = SessionStore.user;
router.events.subscribe((val) => {
@@ -42,23 +44,30 @@ export class HeaderPage implements OnInit {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
} else {
- this.notificationLengthData();
+ this.UpdateNotificationCount();
}
}
- async notificationLengthData() {
+ UpdateNotificationCount() {
+ this.notificationsService.registerCallback(
+ 'any',
+ () => {
+ this.notificationLengthData();
+ }
+ )
+ }
+
+ notificationLengthData() {
this.storageservice.get("Notifications").then((value) => {
console.log("Init get store", value)
- var data = JSON.parse(value);
- this.notificationLength = data.length;
+ /* var data = JSON.parse(value); */
+ this.notificationLength = value.length;
})
- await new Promise(resolve => setTimeout(resolve, 10000))
- await this.notificationLengthData()
console.log('Timer badge count')
}