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:
@@ -106,7 +106,7 @@ export class MessageService {
|
||||
this.sendAttempt++;
|
||||
|
||||
if(!this.hasFile) {
|
||||
this.WsChatService.send({roomId:this.rid, msg:this.msg, requestId: this.localReference}).then(({message, requestId}) => {
|
||||
this.WsChatService.send({roomId:this.rid, msg:this.msg, localReference: this.localReference}).then(({message, requestId}) => {
|
||||
let ChatMessage = message.result
|
||||
|
||||
if (environment.chatOffline) {
|
||||
@@ -137,7 +137,7 @@ export class MessageService {
|
||||
this.temporaryData = {}
|
||||
|
||||
alert('to send')
|
||||
this.WsChatService.send({roomId:this.rid, msg: this.msg, attachments: this.attachments, file: this.file, requestId: this.localReference}).then(({message, requestId}) => {
|
||||
this.WsChatService.send({roomId:this.rid, msg: this.msg, attachments: this.attachments, file: this.file, localReference: this.localReference}).then(({message, requestId}) => {
|
||||
alert('receive11')
|
||||
console.log('message', message)
|
||||
let ChatMessage = message.result
|
||||
|
||||
@@ -96,10 +96,10 @@ export class RoomService {
|
||||
console.log('recivemessage', _ChatMessage)
|
||||
alert('receive and send to view')
|
||||
|
||||
setTimeout(()=>{
|
||||
let ChatMessage = _ChatMessage.fields.args[0]
|
||||
ChatMessage = this.fix_updatedAt(ChatMessage)
|
||||
|
||||
let ChatMessage = _ChatMessage.fields.args[0]
|
||||
ChatMessage = this.fix_updatedAt(ChatMessage)
|
||||
|
||||
if(!this.messagesLocalReference.includes(ChatMessage.localReference)) {
|
||||
const message = this.prepareMessage(ChatMessage)
|
||||
this.lastMessage = message
|
||||
this.calDateDuration(ChatMessage._updatedAt)
|
||||
@@ -121,7 +121,8 @@ export class RoomService {
|
||||
setTimeout(()=>{
|
||||
this.scrollDown()
|
||||
}, 50)
|
||||
}, 150)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
)
|
||||
@@ -404,9 +405,12 @@ export class RoomService {
|
||||
} else {
|
||||
if(environment.chatOffline) alert('create offline')
|
||||
const offlineMessage = this.prepareMessage(ChatMessage)
|
||||
|
||||
this.messagesLocalReference.push(offlineMessage.localReference)
|
||||
offlineMessage.send().then(()=>{
|
||||
this.updateMessageDB(ChatMessage, ChatMessage.localReference)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -437,7 +441,7 @@ export class RoomService {
|
||||
await chatHistory.result.messages.reverse().forEach( async (message) => {
|
||||
|
||||
this.prepareMessage(message)
|
||||
this.messages = this.sortService.sortDate(this.messages, '_updatedAt')
|
||||
// this.messages = this.sortService.sortDate(this.messages, '_updatedAt')
|
||||
|
||||
})
|
||||
|
||||
@@ -459,7 +463,7 @@ export class RoomService {
|
||||
wewMessage.setData(message)
|
||||
wewMessage.loadHistory = this.hasLoadHistory
|
||||
|
||||
if(!message._id && environment.chatOffline) {
|
||||
if(!message._id && environment.chatOffline && save) {
|
||||
if(this.hasLoadHistory && environment.chatOffline) alert('create offline')
|
||||
|
||||
this.messages.push(wewMessage)
|
||||
|
||||
@@ -158,14 +158,16 @@ export class WsChatService {
|
||||
}
|
||||
|
||||
// send message to room
|
||||
send({roomId, msg, attachments = null, file = null, requestId = uuidv4()}) {
|
||||
send({roomId, msg, attachments = null, file = null, localReference = null}) {
|
||||
|
||||
const requestId = uuidv4()
|
||||
var message = {
|
||||
msg: "method",
|
||||
method: "sendMessage",
|
||||
id: requestId,
|
||||
params: [{
|
||||
rid: roomId,
|
||||
localReference: localReference,
|
||||
msg: msg,
|
||||
attachments,
|
||||
file
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
<div class="header-top">
|
||||
<div class="middle">
|
||||
<ion-label class="title">{{ wsChatMethodsService.getDmRoom(roomId).name }}</ion-label>
|
||||
{{ roomId }}
|
||||
|
||||
{{ wsChatMethodsService.getDmRoom(roomId).messages | json }}
|
||||
<!-- <span><ion-icon class="{{users.status}}" name="ellipse"></ion-icon></span> -->
|
||||
</div>
|
||||
<div hidden class="right">
|
||||
|
||||
@@ -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