fix ballon

This commit is contained in:
Peter Maquiran
2024-09-04 10:58:26 +01:00
parent 100d64f799
commit 0f3096b25e
11 changed files with 123 additions and 34 deletions
@@ -351,7 +351,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
async loadAttachment() {
for(const message of this.messages1[this.roomId]) {
if(message.hasAttachment) {
if(message.hasAttachment && message.attachments[0].source != MessageAttachmentSource.Webtrix) {
if(message.$id) {
this.chatServiceService.getMessageAttachmentByMessageId(message).then((result)=> {
@@ -422,6 +422,13 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.messageReceiveSubject?.unsubscribe();
this.messageReceiveSubject = this.chatServiceService.listenToIncomingMessage(this.roomId).subscribe(async (message) => {
const date = whatsappDate(message.sentAt, false)
if(!this.date[date]) {
this.date[date] = true
const Ballon = XBallon(message)
this.messages1[this.roomId].push(Ballon)
}
this.messages1[this.roomId].push(new MessageViewModal(message))
if(message.hasAttachment) {
@@ -754,8 +761,19 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
safeFile: this.sanitiser.bypassSecurityTrustResourceUrl(this.audioRecordedDataUrl)
}]
this.chatServiceService.sendMessage(message, this.roomType)
message.sentAt = new Date().toISOString()
const date = whatsappDate(message.sentAt, false)
if(!this.date[date]) {
this.date[date] = true
const Ballon = XBallon(message)
this.messages1[this.roomId].push(Ballon)
}
this.messages1[this.roomId].push(message)
this.chatServiceService.sendMessage(message, this.roomType)
setTimeout(() => {
this.scrollToBottomClicked()
}, 100)
@@ -811,6 +829,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
message.sentAt = new Date().toISOString()
this.textField = ''
const date = whatsappDate(message.sentAt, false)
if(!this.date[date]) {
this.date[date] = true
const Ballon = XBallon(message)
this.messages1[this.roomId].push(Ballon)
}
this.messages1[this.roomId].push(message)
setTimeout(() => {
this.scrollToBottomClicked()
@@ -997,7 +1023,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
mimeType: 'image/'+picture.value.format
}]
this.messages1[this.roomId].push(new MessageViewModal(message))
const date = whatsappDate(message.sentAt, false)
if(!this.date[date]) {
this.date[date] = true
const Ballon = XBallon(message)
this.messages1[this.roomId].push(Ballon)
}
setTimeout(() => {
this.scrollToBottomClicked()
}, 100)
@@ -1053,6 +1086,13 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
docId: res.data.selected.Id,
}]
const date = whatsappDate(message.sentAt, false)
if(!this.date[date]) {
this.date[date] = true
const Ballon = XBallon(message)
this.messages1[this.roomId].push(Ballon)
}
this.messages1[this.roomId].push(new MessageViewModal(message))
setTimeout(() => {
this.scrollToBottomClicked()
@@ -1143,6 +1183,13 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
description: ''
}]
const date = whatsappDate(message.sentAt, false)
if(!this.date[date]) {
this.date[date] = true
const Ballon = XBallon(message)
this.messages1[this.roomId].push(Ballon)
}
this.messages1[this.roomId].push(message)
setTimeout(() => {
this.scrollToBottomClicked()
@@ -1199,6 +1246,13 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
mimeType: file.value.type
}]
const date = whatsappDate(message.sentAt, false)
if(!this.date[date]) {
this.date[date] = true
const Ballon = XBallon(message)
this.messages1[this.roomId].push(Ballon)
}
this.messages1[this.roomId].push(message)
setTimeout(() => {
this.scrollToBottomClicked()