mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
sync message on recoonect on ui
This commit is contained in:
@@ -140,6 +140,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
messageUpdateSubject: Subscription
|
||||
messageSendSubject: Subscription
|
||||
messageTypingSubject: Subscription
|
||||
messageOnReconnectSubject: Subscription
|
||||
|
||||
messages1: {[key: string]: MessageEntity[]} = {}
|
||||
MessageAttachmentFileType = MessageAttachmentFileType
|
||||
@@ -228,6 +229,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
}) as any
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
messageStatus(message: MessageEntity) {
|
||||
@@ -268,6 +271,22 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
this.sendReadMessage()
|
||||
}, 1000)
|
||||
|
||||
this.messageOnReconnectSubject?.unsubscribe()
|
||||
this.messageOnReconnectSubject = this.chatServiceService.listenToMessageLoadHistory({roomId: this.roomId}).subscribe((messages) => {
|
||||
|
||||
console.log('message', messages);
|
||||
|
||||
for(const message of messages.data) {
|
||||
const found = this.messages1[this.roomId].find((e) => e.id == message.id)
|
||||
|
||||
if(!found) {
|
||||
const msg = new MessageEntity()
|
||||
Object.assign(msg, message)
|
||||
this.messages1[this.roomId].push(msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async loadAttachment() {
|
||||
@@ -424,6 +443,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
});
|
||||
}
|
||||
|
||||
onDisConnect() {}
|
||||
|
||||
toggleEmojiPicker(message: MessageEntity) {
|
||||
if (this.selectedMessage === message) {
|
||||
|
||||
Reference in New Issue
Block a user