chat notification added

This commit is contained in:
Eudes Inácio
2023-02-02 18:24:26 +01:00
parent cc9c5a9cf5
commit f7791805f3
11 changed files with 121 additions and 39 deletions
+9
View File
@@ -27,6 +27,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { StorageService } from 'src/app/services/storage.service';
import { SessionStore } from 'src/app/store/session.service';
import { ChatDebuggingPage } from 'src/app/shared/popover/chat-debugging/chat-debugging.page';
import { EventTrigger } from 'src/app/services/eventTrigger.service';
@Component({
@@ -114,6 +115,7 @@ export class ChatPage implements OnInit {
private storageservice: StorageService,
public ChatSystemService: ChatSystemService,
private activatedRoute: ActivatedRoute,
private eventTriger: EventTrigger
) {
this.headers = new HttpHeaders();
@@ -127,6 +129,13 @@ export class ChatPage implements OnInit {
this.segment = 'Contactos'
this.eventTriger.getObservable().subscribe((event) => {
if(event.notification == "recive") {
this.onSegmentChange()
}
console.log(event)
});
}
ngOnInit() {
+14 -5
View File
@@ -382,15 +382,24 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
sendMessage(msg) {
let lastMsg = msg.pop();
console.log(msg)
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)
})
}
/* sendMessage(msg) {
let lastMsg = msg.pop();
console.log(msg)
console.log(lastMsg._id,lastMsg.u.username,lastMsg.msg)
this.ChatSystemService.getDmRoom(this.roomId).send({}).then(() => {
if(lastMsg.u.username == this.members[1].username) {
this.notificationService.ChatSendMessageNotification(this.members[0].username,this.members[1].name,lastMsg.msg,this.roomId)
} else if (msg.u.username == this.members[0].username) {
this.notificationService.ChatSendMessageNotification(this.members[1].username,this.members[1].name,lastMsg.msg,this.roomId)
}
})
} */
base64toBlob(base64Data, contentType) {
contentType = contentType || '';
var sliceSize = 1024;