add synchro

This commit is contained in:
Peter Maquiran
2021-08-30 10:24:46 +01:00
parent e953831a73
commit 4309d01376
24 changed files with 338 additions and 113 deletions
+12 -6
View File
@@ -13,6 +13,7 @@ import { NavigationExtras,Router } from '@angular/router';
import { ToastService } from '../services/toast.service';
import { Optional } from '@angular/core';
import { JsonStore } from './jsonStore.service';
import { synchro } from './socket/synchro.service';
@Injectable({
providedIn: 'root'
@@ -39,15 +40,17 @@ export class NotificationsService {
private toastService: ToastService,
private zone: NgZone,
private activeroute: ActivatedRoute,
private jsonstore: JsonStore) {
private jsonstore: JsonStore) { }
registerCallback(type: string, funx: Function, object: any = {} ) {
this.callbacks.push({type, funx})
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
synchro.registerCallback('Notification',funx, type)
}
}
registerCallback(type: string, funx: Function ) {
this.callbacks.push({type, funx})
}
getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
@@ -216,6 +219,9 @@ export class NotificationsService {
console.log(message);
var data = JSON.parse(message.payload);
synchro.$send(data)
console.log('data.Service', data.Service); // module
console.log('data.IdObject', data.IdObject); // Object id
console.log('data.Object', data.Object); // details