This commit is contained in:
Peter Maquiran
2022-02-10 22:15:40 +01:00
parent 27e1ee0fe0
commit 9e888acb5d
@@ -264,9 +264,6 @@ export class WsChatMethodsService {
* @param roomData
*/
prepareRoom(roomData) {
let room:RoomService;
room = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService, this.WsChatService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService)
const setData = {
@@ -277,36 +274,40 @@ export class WsChatMethodsService {
lastMessage: this.getRoomLastMessage(roomData),
_updatedAt: new Date(roomData._updatedAt['$date'])
}
room.setData(setData)
room.receiveMessage()
room.getAllUsers = this.getUsers
room.receiveMessageDelete();
room.sortRoomList = this.sortRoomList
let roomId = this.getRoomId(roomData)
if(this.isIndividual(roomData)) {
if(!this.dm[roomId]) {
if(!this.dm[roomId] && !this.group[roomId]) {
let room:RoomService = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService, this.WsChatService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService)
room.setData(setData)
room.receiveMessage()
room.getAllUsers = this.getUsers
room.receiveMessageDelete();
room.sortRoomList = this.sortRoomList
if(this.isIndividual(roomData)) {
this.dm[roomId] = room
this._dm.push(room)
this.dmCount++
} else {
this.dm[roomId].setData(setData)
}
} else {
if(this.group[roomId]) {
this.group[roomId] = room
this._group.push(room)
this.groupCount++
} else {
}
} else {
if(this.dm[roomId]) {
this.dm[roomId].setData(setData)
} else if(this.group[roomId]) {
this.group[roomId].setData(setData)
}
}
}