This commit is contained in:
Peter Maquiran
2022-03-21 15:08:43 +01:00
parent b60d161e7b
commit 751aacd711
2 changed files with 5 additions and 20 deletions
+3 -18
View File
@@ -172,14 +172,13 @@ export class RoomService {
this.id,
"stream-room-messages",
async (IncomingChatMessage:IncomingChatMessage) => {
// console.log('recivemessage========', JSON.stringify(IncomingChatMessage))
let IncomingChatMessageArgs = IncomingChatMessage.fields.args[0]
let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs)
if(!this.messagesLocalReference.includes(ChatMessage.localReference)) {
const message = await this.prepareMessage({message: ChatMessage, save: true})
const message = await this.prepareCreate({message: ChatMessage, save: true})
message.messageSend = true
this.lastMessage = message
@@ -659,11 +658,6 @@ export class RoomService {
wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory
if(!message?._id && environment.chatOffline && save) {
this.messages.push(wewMessage)
return wewMessage
}
let foundIndex;
const found = this.messages.find((MessageService, index) => {
@@ -723,17 +717,8 @@ export class RoomService {
wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory
console.log(message?._id, environment.chatOffline, save)
if(!message?._id && environment.chatOffline && save) {
this.messages.push(wewMessage)
// console.log('add to view')
return wewMessage
}
this.messages.push(wewMessage)
return wewMessage
}
@@ -120,10 +120,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private fileToBase64Service: FileToBase64Service,
private sanitiser: DomSanitizer,
) {
this.loggedUser = authService.ValidatedUserChat['data'];
}
ngOnChanges(changes: SimpleChanges): void {
this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({})
@@ -743,6 +742,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
console.log('Add file', file)
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee)