This commit is contained in:
tiago.kayaya
2021-08-30 18:56:54 +01:00
13 changed files with 235 additions and 70 deletions
+15 -6
View File
@@ -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';
import { environment } from 'src/environments/environment';
@Component({
@@ -32,6 +33,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) => {
@@ -45,21 +47,28 @@ 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')
}