mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
improve
This commit is contained in:
@@ -38,9 +38,6 @@ export class ChatSystemService {
|
||||
currentRoom: RoomService = null
|
||||
users: chatUser[] = []
|
||||
sessionStore = SessionStore
|
||||
|
||||
|
||||
|
||||
delete = []
|
||||
|
||||
constructor(
|
||||
@@ -180,7 +177,7 @@ export class ChatSystemService {
|
||||
for (let roomData of rooms.result.update) {
|
||||
|
||||
const roomId = this.getRoomId(roomData);
|
||||
|
||||
|
||||
if(roomData.t == 'd') {
|
||||
|
||||
let error = false
|
||||
@@ -260,7 +257,6 @@ export class ChatSystemService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
await this.storage.set('Rooms', rooms);
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -309,7 +305,7 @@ export class ChatSystemService {
|
||||
*/
|
||||
subscribeToRoomUpdate(id, roomData) {
|
||||
|
||||
this.defaultSubtribe(id)
|
||||
this.defaultSubtribe(id);
|
||||
|
||||
this.prepareRoom(roomData);
|
||||
|
||||
@@ -323,27 +319,30 @@ export class ChatSystemService {
|
||||
* @param id room id
|
||||
*/
|
||||
private defaultSubtribe(id: any) {
|
||||
|
||||
const room = this.getRoomById(id);
|
||||
|
||||
if(!room.subscribeAttempt) {
|
||||
room.subscribeAttempt = true;
|
||||
|
||||
this.RochetChatConnectorService.streamRoomMessages(id).then((subscription) => {
|
||||
room.status.receive.message = true;
|
||||
})
|
||||
|
||||
this.RochetChatConnectorService.streamRoomMessages(id).then((subscription) => {
|
||||
const room = this.getRoomById(id);
|
||||
room.status.receive.message = true;
|
||||
})
|
||||
this.RochetChatConnectorService.subStreamNotifyRoom(id, 'typing', false).then((subscription) => {
|
||||
room.status.receive.typing = true;
|
||||
//
|
||||
})
|
||||
|
||||
this.RochetChatConnectorService.subStreamNotifyRoom(id, 'readMessage', false).then((subscription) => {
|
||||
room.status.receive.readMessage = true;
|
||||
})
|
||||
|
||||
this.RochetChatConnectorService.streamNotifyRoomDeleteMessage(id).then((subscription) => {
|
||||
room.status.receive.deleteMessage = true;
|
||||
})
|
||||
}
|
||||
|
||||
this.RochetChatConnectorService.subStreamNotifyRoom(id, 'typing', false).then((subscription) => {
|
||||
const room = this.getRoomById(id);
|
||||
room.status.receive.typing = true;
|
||||
//
|
||||
})
|
||||
|
||||
this.RochetChatConnectorService.subStreamNotifyRoom(id, 'readMessage', false).then((subscription) => {
|
||||
const room = this.getRoomById(id);
|
||||
room.status.receive.readMessage = true;
|
||||
})
|
||||
|
||||
this.RochetChatConnectorService.streamNotifyRoomDeleteMessage(id).then((subscription) => {
|
||||
const room = this.getRoomById(id);
|
||||
room.status.receive.deleteMessage = true;
|
||||
})
|
||||
}
|
||||
|
||||
private fix_updatedAt(message) {
|
||||
@@ -396,7 +395,6 @@ export class ChatSystemService {
|
||||
room.chatServiceDeleteRoom = this.deleteRoom
|
||||
|
||||
// create individual room
|
||||
|
||||
if(this.isIndividual(roomData)) {
|
||||
|
||||
this.dm[roomId] = room
|
||||
@@ -411,6 +409,8 @@ export class ChatSystemService {
|
||||
this.groupCount++
|
||||
|
||||
}
|
||||
|
||||
this.defaultSubtribe(roomId)
|
||||
} else {
|
||||
// in this case room is already present, therefor it will only be necessary,
|
||||
// to redefine
|
||||
|
||||
@@ -64,6 +64,8 @@ export class RoomService {
|
||||
}
|
||||
}
|
||||
|
||||
subscribeAttempt = false
|
||||
|
||||
scrollDown = () => { }
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user