Notificaion from chat added

This commit is contained in:
Eudes Inácio
2023-01-30 15:08:00 +01:00
parent 9fea5d8488
commit 32fb80f1bb
9 changed files with 70 additions and 17 deletions
+15
View File
@@ -42,6 +42,7 @@
"@capacitor/keyboard": "^4.1.0",
"@capacitor/local-notifications": "^4.1.4",
"@capacitor/network": "^4.1.0",
"@capacitor/push-notifications": "^4.1.2",
"@capacitor/share": "^4.1.0",
"@capacitor/storage": "^1.2.5",
"@fortawesome/angular-fontawesome": "^0.9.0",
@@ -3533,6 +3534,14 @@
"@capacitor/core": "^4.0.0"
}
},
"node_modules/@capacitor/push-notifications": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/@capacitor/push-notifications/-/push-notifications-4.1.2.tgz",
"integrity": "sha512-ok6CGvedwK1azmf8VWhrNlg6jhi4PFz3HoyS0GNE2ew7+JGnxN77sgK5q1TVzdkge+vkqipO6uu5bD1xfj/pWQ==",
"peerDependencies": {
"@capacitor/core": "^4.0.0"
}
},
"node_modules/@capacitor/share": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@capacitor/share/-/share-4.1.0.tgz",
@@ -40727,6 +40736,12 @@
"integrity": "sha512-GMJ6LmxmrFA55rAaYxgm4tKSZyUmuLRreQz5Gdu0P09Ja8abSjmXa/DX16gOu1I1+wqHWm2rRI6nPkeUH55Ibw==",
"requires": {}
},
"@capacitor/push-notifications": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/@capacitor/push-notifications/-/push-notifications-4.1.2.tgz",
"integrity": "sha512-ok6CGvedwK1azmf8VWhrNlg6jhi4PFz3HoyS0GNE2ew7+JGnxN77sgK5q1TVzdkge+vkqipO6uu5bD1xfj/pWQ==",
"requires": {}
},
"@capacitor/share": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@capacitor/share/-/share-4.1.0.tgz",
+1
View File
@@ -52,6 +52,7 @@
"@capacitor/keyboard": "^4.1.0",
"@capacitor/local-notifications": "^4.1.4",
"@capacitor/network": "^4.1.0",
"@capacitor/push-notifications": "^4.1.2",
"@capacitor/share": "^4.1.0",
"@capacitor/storage": "^1.2.5",
"@fortawesome/angular-fontawesome": "^0.9.0",
+2
View File
@@ -186,6 +186,8 @@ export class ProfilePage implements OnInit {
}
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
} else if (Service === "chat") {
this.zone.run(() => this.router.navigate(['/home/chat', IdObject, 'chat']));
}
// this.notificationservice.tempClearArray();
@@ -258,7 +258,7 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send"
src="assets/icon/theme/gov/icons-chat-record-audio.svg"></ion-icon>
</button>
<button *ngIf="ChatSystemService.getDmRoom(roomId).message" class="btn-no-color" (click)="sendMessage()"
<button *ngIf="ChatSystemService.getDmRoom(roomId).message" class="btn-no-color" (click)="sendMessage(ChatSystemService.getDmRoom(roomId).messages)"
class="btn-no-color">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send"
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
+13 -3
View File
@@ -1,5 +1,5 @@
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'
import { ActivatedRoute, Route, Router } from '@angular/router'
import { GestureController, ModalController, NavParams, PopoverController, Platform, AlertController } from '@ionic/angular';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { EventPerson } from 'src/app/models/eventperson.model';
@@ -41,6 +41,7 @@ import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { Filesystem, Directory } from '@capacitor/filesystem';
import { NewEventPage } from '../../agenda/new-event/new-event.page';
import { NotificationsService } from 'src/app/services/notifications.service';
const IMAGE_DIR = 'stored-images';
@@ -126,6 +127,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
// private document: DocumentViewer
private file: File,
private fileOpener: FileOpener,
private notificationService: NotificationsService,
private router: Router
) {
this.loggedUser = SessionStore.user.ChatData['data'];
this.roomId = this.navParams.get('roomId');
@@ -150,6 +153,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
ngOnInit() {
console.log(this.router.url);
this.createDirectoryImage()
// this.chatService.refreshtoken();
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
@@ -379,8 +383,14 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
window.removeEventListener('scroll', this.scrollChangeCallback, true);
}
sendMessage() {
this.ChatSystemService.getDmRoom(this.roomId).send({})
sendMessage(msg) {
let lastMsg = msg.pop();
console.log(this.attendees)
console.log(lastMsg._id,lastMsg.msg,lastMsg.msg)
this.ChatSystemService.getDmRoom(this.roomId).send({}).then(() => {
console.log(this.members)
this.notificationService.ChatSendMessageNotification(this.members[1].username,this.members[1].name,lastMsg.msg,this.roomId)
})
}
base64toBlob(base64Data, contentType) {
+2 -1
View File
@@ -72,7 +72,7 @@ export class MessageService {
private AESEncrypt: AESEncrypt,
private AttachmentsService: AttachmentsService,
private NetworkServiceService: NetworkServiceService,
private ChatSystemService: ChatSystemService) {
private ChatSystemService: ChatSystemService,) {
}
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference = 'out-'+uuidv4() , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0, origin }:Message) {
@@ -180,6 +180,7 @@ export class MessageService {
async send(): Promise<any> {
if(this.messageSend) {
console.log('sended')
return new Promise((resolve, reject) => {
resolve('solve')
})
+25 -1
View File
@@ -1,7 +1,7 @@
/* eslint-disable */
/* tslint:disable */
import { Injectable, NgZone } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants';
@@ -171,6 +171,28 @@ export class NotificationsService {
);
}
ChatSendMessageNotification(userID,title,bodymsg,roomId) {
const geturl = environment.apiURL + `notifications/send`;
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
const body = {
UserId: 437,
title: "Teste",
body: "Test",
data: {
Service: "chat",
IdObject: roomId
}
};
let id = 437
this.http.post<Tokenn>(geturl+`?userId=${id}&title=${title}&body=${bodymsg}`, body, { headers }).subscribe(data => {
this.active = true
console.log(data)
}, (error) => {
console.log(error)
})
}
tempClearArray(data) {
this.DataArray = new Array;
}
@@ -222,6 +244,8 @@ export class NotificationsService {
}
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/chat', notification.notification.data.IdObject, 'chat']));
}
}
+1 -1
View File
@@ -3,4 +3,4 @@ import { oaprDev } from './suport/oapr'
import { doneITDev } from './suport/doneIt'
export const environment: Environment = doneITDev;
export const environment: Environment = oaprDev;
+8 -8
View File
@@ -1,12 +1,12 @@
export let versionData = {
"shortSHA": "891c44d67",
"SHA": "891c44d67417ea69f48591231f6e5aae690dcdf2",
"branch": "feature_build_ios_v1_3",
"shortSHA": "9fea5d848",
"SHA": "9fea5d8488ddc4e3eb55d0be1821d0e21ec6974a",
"branch": "no_bug_movemente",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Wed Jan 25 15:06:19 2023 +0100'",
"lastCommitMessage": "improve envarionment",
"lastCommitNumber": "4689",
"lastCommitTime": "'Wed Jan 25 15:49:16 2023 +0100'",
"lastCommitMessage": "fix search",
"lastCommitNumber": "4690",
"change": "",
"changeStatus": "On branch feature_build_ios_v1_3\nYour branch and 'origin/feature_build_ios_v1_3' have diverged,\nand have 61 and 1 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.html\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.ts\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/pages/search/search.page.html\n\tmodified: src/app/pages/search/search.page.ts\n\tmodified: src/environments/environment.ts",
"changeAuthor": "peter.maquiran"
"changeStatus": "On branch no_bug_movemente\nYour branch is behind 'origin/no_bug_movemente' by 1 commit, and can be fast-forwarded.\n (use \"git pull\" to update your local branch)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: package-lock.json\n\tmodified: package.json\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/pages/chat/messages/messages.page.html\n\tmodified: src/app/pages/chat/messages/messages.page.ts\n\tmodified: src/app/services/chat/message.service.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/environments/environment.ts",
"changeAuthor": "eudes.inacio"
}