This commit is contained in:
Peter Maquiran
2022-09-30 16:55:09 +01:00
parent 598a145ad4
commit a226f722aa
3 changed files with 35 additions and 30 deletions
+23 -23
View File
@@ -38,9 +38,6 @@ export class ChatSystemService {
currentRoom: RoomService = null currentRoom: RoomService = null
users: chatUser[] = [] users: chatUser[] = []
sessionStore = SessionStore sessionStore = SessionStore
delete = [] delete = []
constructor( constructor(
@@ -260,7 +257,6 @@ export class ChatSystemService {
} }
} }
await this.storage.set('Rooms', rooms); await this.storage.set('Rooms', rooms);
setTimeout(() => { setTimeout(() => {
@@ -309,7 +305,7 @@ export class ChatSystemService {
*/ */
subscribeToRoomUpdate(id, roomData) { subscribeToRoomUpdate(id, roomData) {
this.defaultSubtribe(id) this.defaultSubtribe(id);
this.prepareRoom(roomData); this.prepareRoom(roomData);
@@ -324,26 +320,29 @@ export class ChatSystemService {
*/ */
private defaultSubtribe(id: any) { private defaultSubtribe(id: any) {
this.RochetChatConnectorService.streamRoomMessages(id).then((subscription) => { const room = this.getRoomById(id);
const room = this.getRoomById(id);
room.status.receive.message = true;
})
this.RochetChatConnectorService.subStreamNotifyRoom(id, 'typing', false).then((subscription) => { if(!room.subscribeAttempt) {
const room = this.getRoomById(id); room.subscribeAttempt = true;
room.status.receive.typing = true;
//
})
this.RochetChatConnectorService.subStreamNotifyRoom(id, 'readMessage', false).then((subscription) => { this.RochetChatConnectorService.streamRoomMessages(id).then((subscription) => {
const room = this.getRoomById(id); room.status.receive.message = true;
room.status.receive.readMessage = 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.streamNotifyRoomDeleteMessage(id).then((subscription) => {
const room = this.getRoomById(id);
room.status.receive.deleteMessage = true;
})
} }
private fix_updatedAt(message) { private fix_updatedAt(message) {
@@ -396,7 +395,6 @@ export class ChatSystemService {
room.chatServiceDeleteRoom = this.deleteRoom room.chatServiceDeleteRoom = this.deleteRoom
// create individual room // create individual room
if(this.isIndividual(roomData)) { if(this.isIndividual(roomData)) {
this.dm[roomId] = room this.dm[roomId] = room
@@ -411,6 +409,8 @@ export class ChatSystemService {
this.groupCount++ this.groupCount++
} }
this.defaultSubtribe(roomId)
} else { } else {
// in this case room is already present, therefor it will only be necessary, // in this case room is already present, therefor it will only be necessary,
// to redefine // to redefine
+2
View File
@@ -64,6 +64,8 @@ export class RoomService {
} }
} }
subscribeAttempt = false
scrollDown = () => { } scrollDown = () => { }
/** /**
@@ -51,10 +51,13 @@ export class NewGroupPage implements OnInit{
ngOnInit() { ngOnInit() {
this.task = this.dataService.get("task"); this.task = this.dataService.get("task");
this.groupName = this.task.Folio; if(this.task) {
this.documents = this.dataService.get("documents"); this.groupName = this.task.Folio;
console.log(this.dataService.data); this.documents = this.dataService.get("documents");
this.dataService.set("newGroup", false); console.log(this.dataService.data);
this.dataService.set("newGroup", false);
}
} }
_ionChange(event) { _ionChange(event) {