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
@@ -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) {