mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Merge branch 'feature/websocket' of https://bitbucket.org/equilibriumito/gabinete-digital into feature/websocket
This commit is contained in:
@@ -23,6 +23,8 @@ export class RoomService {
|
||||
|
||||
private ToastService = ToastsService
|
||||
|
||||
scrollDown = () => {}
|
||||
|
||||
constructor(
|
||||
public WsChatService: WsChatService,
|
||||
private MessageService: MessageService,
|
||||
@@ -52,6 +54,11 @@ export class RoomService {
|
||||
this.lastMessage.msg = message.msg
|
||||
this.calDateDuration(ChatMessage._updatedAt)
|
||||
this.massages.push(message)
|
||||
|
||||
setTimeout(()=>{
|
||||
this.scrollDown()
|
||||
}, 100)
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -78,6 +85,11 @@ export class RoomService {
|
||||
|
||||
|
||||
})
|
||||
|
||||
setTimeout(()=>{
|
||||
this.scrollDown()
|
||||
}, 50)
|
||||
|
||||
this.hasLoadHistory = true
|
||||
}
|
||||
|
||||
|
||||
@@ -234,35 +234,13 @@ export class WsChatService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param roomId
|
||||
* @param key
|
||||
* @param funx
|
||||
*/
|
||||
receiveMyMessageConfirmation(roomId, funx: Function) {
|
||||
|
||||
this.ws.registerCallback({
|
||||
type:'Onmessage',
|
||||
funx:(message)=>{
|
||||
if(message.msg =='result') {
|
||||
if(message.result) {
|
||||
if(message.result.msg) {
|
||||
if(message.result.rid == roomId) {
|
||||
funx(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
receiveLiveMessageFromRoom(roomId, funx: Function) {
|
||||
|
||||
const key = roomId + funx;
|
||||
|
||||
this.ws.registerCallback({
|
||||
type:'Onmessage',
|
||||
key: key,
|
||||
funx:(message)=>{
|
||||
if(message.msg =='changed' && message.collection == 'stream-room-messages') {
|
||||
if(message.fields.args[0].rid == roomId) {
|
||||
|
||||
Reference in New Issue
Block a user