mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
merge
This commit is contained in:
@@ -40,45 +40,44 @@ export class NotificationsService {
|
||||
private platform: Platform,
|
||||
private router: Router,
|
||||
private zone: NgZone,
|
||||
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]
|
||||
}
|
||||
|
||||
private async runNotificationCallback(notification) {
|
||||
|
||||
for (const [key, value] of Object.entries(this.callbacks)) {
|
||||
if(value.type == notification.data.Object) {
|
||||
|
||||
const dontRepeat = await value.funx(notification)
|
||||
|
||||
if(dontRepeat) {
|
||||
delete this.callbacks[key]
|
||||
}
|
||||
|
||||
} else if (value.type == '*') {
|
||||
const dontRepeat = await value.funx(notification)
|
||||
|
||||
if(dontRepeat) {
|
||||
delete this.callbacks[key]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private eventtrigger: EventTrigger,) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 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) {
|
||||
|
||||
// const dontRepeat = await value.funx(notification)
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -194,7 +193,7 @@ export class NotificationsService {
|
||||
}
|
||||
|
||||
ChatSendMessageNotification(userID,title,bodymsg,roomId) {
|
||||
const geturl = environment.apiURL + `notifications/send`;
|
||||
const geturl = environment.apiURL + `notifications/sendbyUsername`;
|
||||
|
||||
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
|
||||
const message = {
|
||||
@@ -203,6 +202,23 @@ export class NotificationsService {
|
||||
}
|
||||
let id = 437
|
||||
console.log(userID,title,bodymsg,roomId)
|
||||
this.http.post<Tokenn>(geturl+`?username=${userID}&title=${title}&body=${bodymsg}`, message, { headers }).subscribe(data => {
|
||||
this.active = true
|
||||
console.log(data)
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
ChatSendMessageNotificationGrup(userID,title,bodymsg,roomId) {
|
||||
const geturl = environment.apiURL + `notifications/send`;
|
||||
|
||||
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
|
||||
const message = {
|
||||
"Service": "chat",
|
||||
"IdObject": roomId
|
||||
}
|
||||
console.log(userID,title,bodymsg,roomId)
|
||||
this.http.post<Tokenn>(geturl+`?userId=${userID}&title=${title}&body=${bodymsg}`, message, { headers }).subscribe(data => {
|
||||
this.active = true
|
||||
console.log(data)
|
||||
|
||||
Reference in New Issue
Block a user