mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
improve chat
This commit is contained in:
@@ -7,7 +7,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ChatService {
|
||||
export class wsChatService {
|
||||
|
||||
|
||||
individual: {[key: string]: RoomService} = {}
|
||||
@@ -23,17 +23,19 @@ export class ChatService {
|
||||
) {
|
||||
|
||||
(async()=>{
|
||||
await this.getAllRoom();
|
||||
await this.getAllRooms();
|
||||
this.subscribeToRoom()
|
||||
})()
|
||||
|
||||
}
|
||||
|
||||
async getAllRoom () {
|
||||
async getAllRooms () {
|
||||
this.loadingWholeList = true
|
||||
|
||||
const rooms: any = await this.RocketChatClientService.getRooms();
|
||||
|
||||
console.log(rooms)
|
||||
|
||||
rooms.result.update.forEach((roomData:any) => {
|
||||
let room:RoomService;
|
||||
|
||||
|
||||
@@ -31,4 +31,7 @@ export class MessageService {
|
||||
|
||||
showDateDuration() {}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core'
|
||||
import { RocketChatClientService } from 'src/app/services/socket/rocket-chat-client.service';
|
||||
import { MessageService } from 'src/app/services/chat/message.service'
|
||||
import { ChatUserService } from 'src/app/services/chat/chat-user.service'
|
||||
import { TimeService } from 'src/app/services/functions/time.service';
|
||||
import { ChatService } from '../chat.service';
|
||||
import { showDateDuration } from 'src/plugin/showDateDuration'
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -47,6 +45,7 @@ export class RoomService {
|
||||
message.setData(Chatmessage.result)
|
||||
this.massages.push(message)
|
||||
this.calDateDuration(Chatmessage.result._updatedAt)
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -58,7 +57,7 @@ export class RoomService {
|
||||
// runs onces only
|
||||
loadHistory(limit= 100) {
|
||||
|
||||
if(this.hasLoadHistory){ return false }
|
||||
if(this.hasLoadHistory){ return false}
|
||||
|
||||
this.RocketChatClientService.loadHistory(this.id, limit).then((message:any) => {
|
||||
console.log('loadHistory', message)
|
||||
|
||||
Reference in New Issue
Block a user