mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
save
This commit is contained in:
@@ -57,6 +57,15 @@ export class RoomService {
|
||||
chatOpen = false
|
||||
messageUnread = false
|
||||
|
||||
status = {
|
||||
receive: {
|
||||
message: false,
|
||||
typing: false,
|
||||
readMessage: false,
|
||||
deleteMessage: false
|
||||
}
|
||||
}
|
||||
|
||||
scrollDown = () => { }
|
||||
|
||||
/**
|
||||
@@ -128,6 +137,17 @@ export class RoomService {
|
||||
}
|
||||
})
|
||||
|
||||
this.WsChatService.registerCallback({
|
||||
type: 'Offline',
|
||||
funx: () => {
|
||||
/**
|
||||
* @description when the phone is in the background for a long time it could disconnects from the socket then the socket reconnects automatically,
|
||||
* when the connection is lost the subscribe is also lost, so we have to subscribe again when reconnection is establish.
|
||||
*/
|
||||
this.resetStatus();
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,6 +170,18 @@ export class RoomService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resetStatus() {
|
||||
this.status = {
|
||||
receive: {
|
||||
message: false,
|
||||
typing: false,
|
||||
readMessage: false,
|
||||
deleteMessage: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setData({members, u, customFields = {}, id, name, t, lastMessage = new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService), _updatedAt }) {
|
||||
this.customFields = customFields
|
||||
this.id = id
|
||||
@@ -454,9 +486,14 @@ export class RoomService {
|
||||
|
||||
//Get previous last message from room
|
||||
const previousLastMessage = this.messages.slice(-1)[0];
|
||||
this.lastMessage = previousLastMessage;
|
||||
this.calDateDuration(previousLastMessage._updatedAt)
|
||||
this.sortRoomList()
|
||||
|
||||
if(previousLastMessage) {
|
||||
this.lastMessage = previousLastMessage;
|
||||
console.log("last message"+ previousLastMessage)
|
||||
this.calDateDuration(previousLastMessage._updatedAt)
|
||||
this.sortRoomList()
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user