Merge with peter changes

This commit is contained in:
Eudes Inácio
2021-08-30 15:00:44 +01:00
37 changed files with 560 additions and 208 deletions
+18 -8
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;
@@ -168,9 +171,13 @@ export class NotificationsService {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
);
)
} else {
console.log('not called')
}
}
} else {
console.log('not called')
}
}
@@ -216,6 +223,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