Git pull made

This commit is contained in:
Eudes Inácio
2023-02-02 18:28:17 +01:00
107 changed files with 1262 additions and 525 deletions
+28 -26
View File
@@ -12,6 +12,7 @@ import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service';
import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } from '@capacitor/push-notifications';
import { notificationObject } from '../models/notifications';
import { v4 as uuidv4 } from 'uuid'
@Injectable({
providedIn: 'root'
@@ -38,43 +39,44 @@ export class NotificationsService {
private platform: Platform,
private router: Router,
private zone: NgZone,
private eventtrigger: EventTrigger,) {
private eventtrigger: EventTrigger,) {}
registerCallback({type, funx, id = uuidv4()} : {
type: notificationObject,
funx: Function
id?: string
}) {
this.callbacks[id] = { funx, id, type}
return id;
}
deleteCallback(id) {
delete this.callbacks[id]
}
// registerCallback({type, funx, id = uuidv4()} : {
// type: notificationObject,
// funx: Function
// id?: string
// }) {
// this.callbacks[id] = { funx, id, type}
// return id;
// }
private async runNotificationCallback(notification) {
for (const [key, value] of Object.entries(this.callbacks)) {
if(value.type == notification.data.Object) {
// private async runNotificationCallback(notification) {
const dontRepeat = await value.funx(notification)
// for (const [key, value] of Object.entries(this.callbacks)) {
// if(value.type == notification.data.Object) {
if(dontRepeat) {
delete this.callbacks[key]
}
// const dontRepeat = await value.funx(notification)
} else if (value.type == '*') {
const dontRepeat = await value.funx(notification)
// if(dontRepeat) {
// delete this.callbacks[key]
// }
if(dontRepeat) {
delete this.callbacks[key]
}
}
// } else if (value.type == '*') {
// const dontRepeat = await value.funx(notification)
}
// if(dontRepeat) {
// delete this.callbacks[key]
// }
// }
// }
// }
}
getTokenByUserIdAndId(user, userID) {
// const geturl = environment.apiURL + 'notifications/user/' + userID;