mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge with peter changes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user