git pull made

This commit is contained in:
Eudes Inácio
2021-09-07 12:18:12 +01:00
148 changed files with 1885 additions and 2257 deletions
+32 -9
View File
@@ -14,7 +14,7 @@ import { ToastService } from '../services/toast.service';
import { Optional } from '@angular/core';
import { JsonStore } from './jsonStore.service';
import { synchro } from './socket/synchro.service';
import { v4 as uuidv4 } from 'uuid'
@Injectable({
providedIn: 'root'
})
@@ -27,10 +27,11 @@ export class NotificationsService {
callbacks: {
type: string,
funx: Function
id: string
}[] = []
constructor(
private http: HttpClient,
private http: HttpClient,
private storageService: StorageService,
private modalController: ModalController,
public modalCtrl: AlertController,
@@ -40,17 +41,39 @@ 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.storageService.get("Notifications").then((value) => {
}).catch(()=>{
this.storageService.store("Notifications",[])
})
this.callbacks.push({type, funx})
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
synchro.registerCallback('Notification',funx, type)
}
}
registerCallback(type: string, funx: Function, object: any = {} ) {
const id = uuidv4()
this.callbacks.push({type, funx, id})
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
synchro.registerCallback('Notification',funx, type)
}
return id;
}
deleteCallback(id) {
this.callbacks.forEach((e, index)=>{
if(e.id == id) {
if (index > -1) {
this.callbacks.splice(index, 1);
}
}
})
}
getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;