diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 29b4d2352..1bf94036b 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -71,7 +71,7 @@ export class HomePage implements OnInit { constructor(private zone: NgZone, private router: Router, public modalCtrl: AlertController, - private notificatinsservice: NotificationsService, + private notificationsService: NotificationsService, private platform: Platform, private activeroute: ActivatedRoute, // private network: NetworkService, @@ -99,6 +99,18 @@ export class HomePage implements OnInit { //this.folderId = this.navParams.get('folderId'); } + + this.notificationsService.registerCallback( + 'Create Depacho', + () =>{ + this.refreshing() + } + ) + + } + + refreshing() { + } ngOnInit() { @@ -109,8 +121,8 @@ export class HomePage implements OnInit { console.log('Notifications not supported') } else { this.mobilefirstConnect(); - this.notificatinsservice.getAndpostToken2(); - this.notificatinsservice.onReceviNotification(); + this.notificationsService.getAndpostToken2(); + this.notificationsService.onReceviNotification(); } } diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 8cea9c12e..5b0b9d7fc 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -26,6 +26,7 @@ import { NavigationStart, NavigationEnd, Router } from '@angular/router'; import { EventPerson } from 'src/app/models/eventperson.model'; import { removeDuplicate } from 'src/plugin/removeDuplicate.js' import { environment } from 'src/environments/environment'; +import { NotificationsService } from 'src/app/services/notifications.service'; @Component({ selector: 'app-chat', diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 1a3a32dda..79e19a185 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -23,6 +23,11 @@ export class NotificationsService { folderId: string; DataArray: Array = []; + callbacks: { + type: string, + funx: Function + }[] = [] + constructor( private http: HttpClient, private storageService: StorageService, @@ -34,7 +39,20 @@ export class NotificationsService { private toastService: ToastService, private zone: NgZone, private activeroute: ActivatedRoute, - private jsonstore: JsonStore) { } + private jsonstore: JsonStore) { + + this.callbacks.forEach(e=> { + if(e.type = 'Create Depacho') { + e.funx() + } + }) + + } + + + registerCallback(type: string, funx: Function ) { + this.callbacks.push({type, funx}) + } getTokenByUserIdAndId(user, userID) { const geturl = environment.apiURL + 'notifications/user/' + userID; diff --git a/src/app/shared/agenda/new-event/new-event.page.html b/src/app/shared/agenda/new-event/new-event.page.html index 38ca7646d..c06351678 100644 --- a/src/app/shared/agenda/new-event/new-event.page.html +++ b/src/app/shared/agenda/new-event/new-event.page.html @@ -186,11 +186,11 @@ - + diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index acd3d076d..4a28ebb23 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -67,7 +67,7 @@ export class NewEventPage implements OnInit { public stepMinute = 5; public stepSecond = 5; public color: ThemePalette = 'primary'; - recurringTypes: any; + recurringTypes = [] selectedRecurringType: any; @Input() profile:string; diff --git a/src/app/store/chat/chat-user.service.ts b/src/app/store/chat/chat-user.service.ts index eb60b2941..e18ce4ad5 100644 --- a/src/app/store/chat/chat-user.service.ts +++ b/src/app/store/chat/chat-user.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -import { localstoreService } from '../localstore.service' -import { SHA1 } from 'crypto-js' +import { localstoreService } from '../localstore.service'; +import { SHA1 } from 'crypto-js'; @Injectable({ providedIn: 'root' @@ -16,7 +16,7 @@ export class ChatUserService { this.keyName = ('chat'+SHA1(this.constructor.name)).toString() - setTimeout(()=>{ + setTimeout(()=> { let restore = localstoreService.get(this.keyName, {}) this._userList = restore.userList || {} }, 10)