mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
save
This commit is contained in:
@@ -44,7 +44,7 @@ export class WsChatMethodsService {
|
||||
private NfService: NfService,
|
||||
private changeProfileService: ChangeProfileService,
|
||||
) {
|
||||
|
||||
|
||||
this.loadChat()
|
||||
|
||||
this.WsChatService.registerCallback({
|
||||
@@ -63,7 +63,7 @@ export class WsChatMethodsService {
|
||||
for (const id in this.dm) {
|
||||
this.dm[id].hasLoadHistory = false
|
||||
}
|
||||
|
||||
|
||||
for (const id in this.group) {
|
||||
this.group[id].hasLoadHistory = false
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export class WsChatMethodsService {
|
||||
this.storage.remove('Rooms');
|
||||
})
|
||||
|
||||
|
||||
|
||||
// this.WsChatService.registerCallback({
|
||||
// type:'Onmessage',
|
||||
// funx:(message) => {
|
||||
@@ -95,7 +95,7 @@ export class WsChatMethodsService {
|
||||
// }
|
||||
// } else if(message.msg =='changed' && message.collection == "stream-notify-room") {
|
||||
// if(message.fields.eventName.includes('deleteMessage')) {
|
||||
// // delete message
|
||||
// // delete message
|
||||
// const DeletedMessageId = message.fields.args[0]._id;
|
||||
|
||||
// setTimeout(()=>{
|
||||
@@ -129,7 +129,7 @@ export class WsChatMethodsService {
|
||||
|
||||
clearChat() {
|
||||
this.dm = {}
|
||||
this.group = {}
|
||||
this.group = {}
|
||||
this._dm = []
|
||||
this._group = []
|
||||
|
||||
@@ -137,7 +137,7 @@ export class WsChatMethodsService {
|
||||
|
||||
this.dmCount = 0;
|
||||
this.groupCount = 0;
|
||||
|
||||
|
||||
this.currentRoom = null
|
||||
this.users = []
|
||||
}
|
||||
@@ -159,11 +159,11 @@ export class WsChatMethodsService {
|
||||
if(this.getDmRoom(roomId)) {
|
||||
this.currentRoom = this.getDmRoom(roomId)
|
||||
} else if(this.getGroupRoom(roomId)) {
|
||||
this.currentRoom = this.getGroupRoom(roomId)
|
||||
this.currentRoom = this.getGroupRoom(roomId)
|
||||
}
|
||||
|
||||
this.currentRoom.open()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ export class WsChatMethodsService {
|
||||
await rooms.result.update.forEach( async (roomData: room) => {
|
||||
await this.prepareRoom(roomData);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch(e){}
|
||||
@@ -274,7 +274,7 @@ export class WsChatMethodsService {
|
||||
lastMessage: this.getRoomLastMessage(roomData),
|
||||
_updatedAt: new Date(roomData._updatedAt['$date'])
|
||||
}
|
||||
|
||||
|
||||
let roomId = this.getRoomId(roomData)
|
||||
|
||||
if(!this.dm[roomId] && !this.group[roomId]) {
|
||||
@@ -284,18 +284,18 @@ export class WsChatMethodsService {
|
||||
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.group[roomId] = room
|
||||
this._group.push(room)
|
||||
this.groupCount++
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -376,7 +376,24 @@ export class WsChatMethodsService {
|
||||
return this.WsChatService.leaveRoom(id);
|
||||
}
|
||||
|
||||
async hideRoom(id) {
|
||||
this._dm.forEach((md, index)=>{
|
||||
if(md.id == id) {
|
||||
this._dm.splice(index, 1)
|
||||
delete this.dm[id]
|
||||
}
|
||||
});
|
||||
|
||||
this._group.forEach((group, index)=>{
|
||||
if(group.id == id) {
|
||||
this._group.splice(index, 1)
|
||||
delete this.group[id]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
hidingRoom(id?) {
|
||||
//this.hideRoom(id);
|
||||
return this.WsChatService.hidingRoom(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -254,6 +254,8 @@ export class WsChatService {
|
||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
||||
if(message.id == requestId ) { // same request send
|
||||
resolve(message)
|
||||
console.log(message);
|
||||
|
||||
return true
|
||||
}
|
||||
}})
|
||||
@@ -636,7 +638,7 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
setTimeout(()=>{
|
||||
this.ws.wsMsgQueue()
|
||||
}, 10)
|
||||
|
||||
|
||||
if(this.wsReconnect >= 1) {
|
||||
for (const [key, value] of Object.entries(this.wsCallbacks)) {
|
||||
if(value.type== 'reConnect') {
|
||||
@@ -679,7 +681,7 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
} else {
|
||||
let messageStr = JSON.stringify(message)
|
||||
// console.log('messageStr', messageStr)
|
||||
|
||||
|
||||
this.socket.send(messageStr)
|
||||
}
|
||||
return requestId
|
||||
|
||||
Reference in New Issue
Block a user