diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html index f84bff5d9..25ccf90b8 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html @@ -69,7 +69,7 @@ - diff --git a/src/app/services/chat/message.service.ts b/src/app/services/chat/message.service.ts index 0d3509a4c..364e8fdab 100644 --- a/src/app/services/chat/message.service.ts +++ b/src/app/services/chat/message.service.ts @@ -371,6 +371,13 @@ export class MessageService { var memeberTosend = this.ChatSystemService.getRoomById(this.rid).membersExcludeMe console.log(ChatMessage) this.notificationService.ChatSendMessageNotification(memeberTosend[0].username,ChatMessage.u.name,ChatMessage.msg,this.rid) + } else { + var memeberTosend = this.ChatSystemService.getRoomById(this.rid).membersExcludeMe + var usersNames = []; + for(let i = 0; i < memeberTosend.length; i++) { + usersNames.push(memeberTosend[i].username) + } + this.notificationService.ChatSendMessageNotificationGrup(usersNames,ChatMessage.u.name,ChatMessage.msg,this.rid) } diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 820e63d57..daf51c1b0 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -24,11 +24,13 @@ export class NotificationsService { DataArray = new Array(); - callbacks: {[key: string]: { - type: notificationObject, - funx: Function - id: string - }} = {} + callbacks: { + [key: string]: { + type: notificationObject, + funx: Function + id: string + } + } = {} active = false isPushNotificationsAvailable = Capacitor.isPluginAvailable('PushNotifications'); @@ -85,8 +87,8 @@ export class NotificationsService { } requestPermissions() { - if(!this.isPushNotificationsAvailable) { - return false + if (!this.isPushNotificationsAvailable) { + return false } PushNotifications.requestPermissions().then(result => { @@ -100,36 +102,36 @@ export class NotificationsService { } getAndpostToken(username) { - if(!this.isPushNotificationsAvailable) { - return false + if (!this.isPushNotificationsAvailable) { + return false } const geturl = environment.apiURL + 'notifications/token'; PushNotifications.addListener('registration', (token: Token) => { - const headers = { 'Authorization': SessionStore.user.BasicAuthKey }; - const body = { - UserId: SessionStore.user.UserId, - TokenId: token.value, - Status: 1, - Service: 1 - }; + const headers = { 'Authorization': SessionStore.user.BasicAuthKey }; + const body = { + UserId: SessionStore.user.UserId, + TokenId: token.value, + Status: 1, + Service: 1 + }; - this.http.post(`${geturl}`, body, { headers }).subscribe(data => { - this.active = true - console.log(data) - }, (error) => { - console.log(error) - }) + this.http.post(`${geturl}`, body, { headers }).subscribe(data => { + this.active = true + console.log(data) + }, (error) => { + console.log(error) + }) } ); - + } registrationError() { - if(!this.isPushNotificationsAvailable) { - return false + if (!this.isPushNotificationsAvailable) { + return false } PushNotifications.addListener('registrationError', @@ -140,44 +142,44 @@ export class NotificationsService { } onReciveForeground() { - if(!this.isPushNotificationsAvailable) { - return false + if (!this.isPushNotificationsAvailable) { + return false } console.log('foregrund'); - PushNotifications.addListener('pushNotificationReceived', - (notification: PushNotificationSchema) => { + PushNotifications.addListener('pushNotificationReceived', + (notification: PushNotificationSchema) => { this.active = true - console.log(notification) - //this.DataArray.push(notification) - //console.log(this.DataArray) - - this.storageService.get("Notifications").then((store) => { - store.push(notification) - this.storageService.store("Notifications", store) - }).catch((error) => { - if(!error) { - this.storageService.store("Notifications", [notification]) - } - }) - - // this.runNotificationCallback(notification) - /* this.eventTriger.publish('notificatioRecive') */ - this.eventtrigger.publishSomeData({ - notification: "recive" - }) - } - ); + console.log(notification) + //this.DataArray.push(notification) + //console.log(this.DataArray) + + this.storageService.get("Notifications").then((store) => { + store.push(notification) + this.storageService.store("Notifications", store) + }).catch((error) => { + if (!error) { + this.storageService.store("Notifications", [notification]) + } + }) + + // this.runNotificationCallback(notification) + /* this.eventTriger.publish('notificatioRecive') */ + this.eventtrigger.publishSomeData({ + notification: "recive" + }) + } + ); } onReciveBackground() { - if(!this.isPushNotificationsAvailable) { - return false + if (!this.isPushNotificationsAvailable) { + return false } console.log('fbackgrund'); - PushNotifications.addListener('pushNotificationActionPerformed', - (notification: ActionPerformed) => { + PushNotifications.addListener('pushNotificationActionPerformed', + (notification: ActionPerformed) => { this.active = true console.log(notification) /* this.DataArray.push(notification.notification) @@ -186,45 +188,48 @@ export class NotificationsService { this.eventtrigger.publishSomeData({ notification: "recive" }) */ - this.notificatinsRoutes(notification) - // this.runNotificationCallback(notification) - } - ); + this.notificatinsRoutes(notification) + // this.runNotificationCallback(notification) + } + ); } - ChatSendMessageNotification(userID,title,bodymsg,roomId) { + ChatSendMessageNotification(userID, title, bodymsg, roomId) { const geturl = environment.apiURL + `notifications/sendbyUsername`; const headers = { 'Authorization': SessionStore.user.BasicAuthKey }; - const message = { - "Service": "chat", - "IdObject": roomId - } - let id = 437 - console.log(userID,title,bodymsg,roomId) - this.http.post(geturl+`?username=${userID}&title=${title}&body=${bodymsg}`, message, { headers }).subscribe(data => { - this.active = true - console.log(data) - }, (error) => { - console.log(error) - }) + const message = { + "Service": "chat", + "IdObject": roomId + } + let id = 437 + console.log(userID, title, bodymsg, roomId) + this.http.post(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`; + ChatSendMessageNotificationGrup(usersID, title, bodymsg, roomId) { + const geturl = environment.apiURL + `notifications/sendByUsernames`; const headers = { 'Authorization': SessionStore.user.BasicAuthKey }; - const message = { - "Service": "chat", - "IdObject": roomId - } - console.log(userID,title,bodymsg,roomId) - this.http.post(geturl+`?userId=${userID}&title=${title}&body=${bodymsg}`, message, { headers }).subscribe(data => { - this.active = true - console.log(data) - }, (error) => { - console.log(error) - }) + const message = { + "Users": usersID, + "NotificationData": { + "Service": "chat", + "IdObject": roomId + } + } + console.log(usersID, title, bodymsg, roomId) + this.http.post(geturl + `?title=${title}&body=${bodymsg}`, message, { headers }).subscribe(data => { + this.active = true + console.log(data) + }, (error) => { + console.log(error) + }) } tempClearArray(data) { @@ -234,51 +239,51 @@ export class NotificationsService { notificatinsRoutes = (notification) => { - - if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) { - - this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expediente") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "agenda" && notification.notification.data.Object === "event-list") { - //this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda'])); - this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.notification.data.IdObject, 'agenda'])); - } else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") { + if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true })); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") { + this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expediente") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "agenda" && notification.notification.data.Object === "event-list") { + //this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda'])); + this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.notification.data.IdObject, 'agenda'])); - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") { + } else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true })); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") { - this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject])); - } - else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") { - this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital'])); - } else if (notification.notification.data.Service === "chat") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") { + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") { + this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject])); + } + else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") { + this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") { + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital'])); + } else if (notification.notification.data.Service === "chat") { let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.IdObject, } }; this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras)); } diff --git a/version/git-version.ts b/version/git-version.ts index ede22e2f3..5074bf6d0 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "35945a55e", - "SHA": "35945a55e747eca0538c0032b782a7acdbd453db", + "shortSHA": "98f543772", + "SHA": "98f543772e82b240d4c2b05f81d7be2d66118715", "branch": "no_bug_movemente", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Mon Feb 6 15:00:42 2023 +0100'", - "lastCommitMessage": "remove refresh button", - "lastCommitNumber": "4734", + "lastCommitTime": "'Mon Feb 6 16:30:11 2023 +0100'", + "lastCommitMessage": "set time by default and round number to 15", + "lastCommitNumber": "4735", "change": "", - "changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/modals/document-set-up-meeting/document-set-up-meeting.page.html\n\tmodified: src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts\n\tmodified: src/app/models/publicationfolder.ts\n\tmodified: src/app/pages/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.html\n\tmodified: src/app/pages/agenda/new-event/new-event.page.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html\n\tmodified: src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts\n\tmodified: src/app/pages/publications/new-action/new-action.page.html\n\tmodified: src/app/pages/publications/new-action/new-action.page.ts\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/shared/agenda/new-event/new-event.page.html\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/publication/new-action/new-action.page.html\n\tmodified: src/app/shared/publication/new-action/new-action.page.ts", + "changeStatus": "On branch no_bug_movemente\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html\n\tmodified: src/app/services/chat/message.service.ts\n\tmodified: src/app/services/notifications.service.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file