mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve
This commit is contained in:
@@ -193,11 +193,6 @@ export class WsChatMethodsService {
|
||||
|
||||
console.log('rooms', rooms)
|
||||
|
||||
this.dm = {}
|
||||
this.group = {}
|
||||
this._dm = []
|
||||
this._group = []
|
||||
|
||||
await rooms.result.update.forEach( async (roomData: room) => {
|
||||
await this.prepareRoom(roomData);
|
||||
});
|
||||
@@ -273,14 +268,17 @@ export class WsChatMethodsService {
|
||||
|
||||
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)
|
||||
|
||||
room.setData({
|
||||
|
||||
const setData = {
|
||||
customFields: roomData.customFields,
|
||||
id: this.getRoomId(roomData),
|
||||
name: this.getRoomName(roomData),
|
||||
t: roomData.t,
|
||||
lastMessage: this.getRoomLastMessage(roomData),
|
||||
_updatedAt: new Date(roomData._updatedAt['$date'])
|
||||
})
|
||||
}
|
||||
|
||||
room.setData(setData)
|
||||
|
||||
room.receiveMessage()
|
||||
room.getAllUsers = this.getUsers
|
||||
@@ -290,13 +288,24 @@ export class WsChatMethodsService {
|
||||
let roomId = this.getRoomId(roomData)
|
||||
|
||||
if(this.isIndividual(roomData)) {
|
||||
this.dm[roomId] = room
|
||||
this._dm.push(room)
|
||||
this.dmCount++
|
||||
|
||||
if(!this.dm[roomId]) {
|
||||
this.dm[roomId] = room
|
||||
this._dm.push(room)
|
||||
this.dmCount++
|
||||
} else {
|
||||
this.dm[roomId].setData(setData)
|
||||
}
|
||||
|
||||
} else {
|
||||
this.group[roomId] = room
|
||||
this._group.push(room)
|
||||
this.groupCount++
|
||||
if(this.group[roomId]) {
|
||||
this.group[roomId] = room
|
||||
this._group.push(room)
|
||||
this.groupCount++
|
||||
} else {
|
||||
this.group[roomId].setData(setData)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user