mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
load messages
This commit is contained in:
@@ -166,12 +166,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
|
||||
|
||||
this.roomData$ = this.roomRepositoryService.getItemByIdLive(this.roomId)
|
||||
this.getMessages();
|
||||
this.listenToIncomingMessage();
|
||||
this.listenToDeleteMessage();
|
||||
this.listenToUpdateMessage();
|
||||
this.listenToSendMessage();
|
||||
this.listenToSendMessage()
|
||||
|
||||
this.roomMessage$ = this.messageRepositoryService.getItemsLive(this.roomId)
|
||||
this.roomMembers$ = this.roomRepositoryService.getRoomMemberByIdLive(this.roomId) as any
|
||||
@@ -193,17 +195,17 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
async getMessages() {
|
||||
|
||||
// dont remove this line
|
||||
this.messages1[this.roomId] = []
|
||||
let messages = await this.messageRepositoryService.getItems(this.roomId)
|
||||
|
||||
|
||||
this.messages1[this.roomId] = []
|
||||
this.messages1[this.roomId] = messages
|
||||
|
||||
this.messages1[this.roomId] = this.sortBySentAt(this.messages1[this.roomId])
|
||||
|
||||
this.loadAttachment()
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollToBottomClicked()
|
||||
}, 100)
|
||||
}, 200)
|
||||
|
||||
}
|
||||
|
||||
@@ -217,14 +219,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
})
|
||||
|
||||
if(result.isOk()) {
|
||||
|
||||
message.attachments[0].safeFile = result.value
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Sorting function
|
||||
@@ -818,11 +818,11 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
message.sentAt = new Date().toISOString()
|
||||
|
||||
message.attachments = [{
|
||||
file: compressedImage.value,
|
||||
file: compressedImage.value.split(',')[1],
|
||||
fileName: "foto",
|
||||
source: MessageAttachmentSource.Device,
|
||||
fileType: MessageAttachmentFileType.Image,
|
||||
mimeType: picture.value.format
|
||||
mimeType: 'image/'+picture.value.format
|
||||
}]
|
||||
|
||||
this.messages1[this.roomId].push(message)
|
||||
|
||||
Reference in New Issue
Block a user