mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve
This commit is contained in:
@@ -143,7 +143,7 @@ export class MessageService {
|
||||
let ChatMessage = message.result
|
||||
|
||||
if (environment.chatOffline) {
|
||||
this.redefinedMessage(ChatMessage)
|
||||
// this.redefinedMessage(ChatMessage)
|
||||
this.offline = false
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ export class RoomService {
|
||||
this._updatedAt = _updatedAt
|
||||
|
||||
this.calDateDuration()
|
||||
|
||||
this.restoreMessageFromDB()
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +96,6 @@ export class RoomService {
|
||||
"stream-room-messages",
|
||||
(_ChatMessage) => {
|
||||
console.log('recivemessage', _ChatMessage)
|
||||
alert('receive and send to view')
|
||||
|
||||
let ChatMessage = _ChatMessage.fields.args[0]
|
||||
ChatMessage = this.fix_updatedAt(ChatMessage)
|
||||
@@ -270,7 +271,7 @@ export class RoomService {
|
||||
*/
|
||||
async send({file = null, attachments = null, temporaryData = {}}) {
|
||||
|
||||
const localReference = uuidv4() + 'peter'
|
||||
const localReference = uuidv4()
|
||||
|
||||
let offlineChatMessage = {
|
||||
rid: this.id,
|
||||
@@ -403,7 +404,7 @@ export class RoomService {
|
||||
if(wewMessage.offline == false) {
|
||||
this.prepareMessage(ChatMessage)
|
||||
} else {
|
||||
if(environment.chatOffline) alert('create offline')
|
||||
|
||||
const offlineMessage = this.prepareMessage(ChatMessage)
|
||||
|
||||
this.messagesLocalReference.push(offlineMessage.localReference)
|
||||
@@ -432,7 +433,6 @@ export class RoomService {
|
||||
return false
|
||||
}
|
||||
}
|
||||
await this.restoreMessageFromDB()
|
||||
|
||||
await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => {
|
||||
console.log('loadHistory', chatHistory)
|
||||
@@ -464,7 +464,6 @@ export class RoomService {
|
||||
wewMessage.loadHistory = this.hasLoadHistory
|
||||
|
||||
if(!message._id && environment.chatOffline && save) {
|
||||
if(this.hasLoadHistory && environment.chatOffline) alert('create offline')
|
||||
|
||||
this.messages.push(wewMessage)
|
||||
return wewMessage
|
||||
@@ -480,7 +479,6 @@ export class RoomService {
|
||||
})
|
||||
|
||||
if (save && !found) {
|
||||
if(this.hasLoadHistory && environment.chatOffline) alert('not found')
|
||||
this.messages.push(wewMessage)
|
||||
}
|
||||
|
||||
|
||||
@@ -193,11 +193,6 @@ export class WsChatMethodsService {
|
||||
|
||||
console.log('rooms', rooms)
|
||||
|
||||
this.dm = {}
|
||||
this.group = {}
|
||||
this._dm = []
|
||||
this._group = []
|
||||
|
||||
await rooms.result.update.forEach( async (roomData: room) => {
|
||||
await this.prepareRoom(roomData);
|
||||
});
|
||||
@@ -273,14 +268,17 @@ export class WsChatMethodsService {
|
||||
|
||||
room = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService, this.WsChatService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService)
|
||||
|
||||
room.setData({
|
||||
|
||||
const setData = {
|
||||
customFields: roomData.customFields,
|
||||
id: this.getRoomId(roomData),
|
||||
name: this.getRoomName(roomData),
|
||||
t: roomData.t,
|
||||
lastMessage: this.getRoomLastMessage(roomData),
|
||||
_updatedAt: new Date(roomData._updatedAt['$date'])
|
||||
})
|
||||
}
|
||||
|
||||
room.setData(setData)
|
||||
|
||||
room.receiveMessage()
|
||||
room.getAllUsers = this.getUsers
|
||||
@@ -290,13 +288,24 @@ export class WsChatMethodsService {
|
||||
let roomId = this.getRoomId(roomData)
|
||||
|
||||
if(this.isIndividual(roomData)) {
|
||||
this.dm[roomId] = room
|
||||
this._dm.push(room)
|
||||
this.dmCount++
|
||||
|
||||
if(!this.dm[roomId]) {
|
||||
this.dm[roomId] = room
|
||||
this._dm.push(room)
|
||||
this.dmCount++
|
||||
} else {
|
||||
this.dm[roomId].setData(setData)
|
||||
}
|
||||
|
||||
} else {
|
||||
this.group[roomId] = room
|
||||
this._group.push(room)
|
||||
this.groupCount++
|
||||
if(this.group[roomId]) {
|
||||
this.group[roomId] = room
|
||||
this._group.push(room)
|
||||
this.groupCount++
|
||||
} else {
|
||||
this.group[roomId].setData(setData)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export const environment = {
|
||||
domain: 'gabinetedigital.local', //gabinetedigital.local
|
||||
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
||||
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||
chatOffline: false
|
||||
chatOffline: true
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user