mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
improve
This commit is contained in:
@@ -106,7 +106,7 @@ export class MessageService {
|
|||||||
this.sendAttempt++;
|
this.sendAttempt++;
|
||||||
|
|
||||||
if(!this.hasFile) {
|
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
|
let ChatMessage = message.result
|
||||||
|
|
||||||
if (environment.chatOffline) {
|
if (environment.chatOffline) {
|
||||||
@@ -137,7 +137,7 @@ export class MessageService {
|
|||||||
this.temporaryData = {}
|
this.temporaryData = {}
|
||||||
|
|
||||||
alert('to send')
|
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')
|
alert('receive11')
|
||||||
console.log('message', message)
|
console.log('message', message)
|
||||||
let ChatMessage = message.result
|
let ChatMessage = message.result
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ export class RoomService {
|
|||||||
console.log('recivemessage', _ChatMessage)
|
console.log('recivemessage', _ChatMessage)
|
||||||
alert('receive and send to view')
|
alert('receive and send to view')
|
||||||
|
|
||||||
setTimeout(()=>{
|
|
||||||
let ChatMessage = _ChatMessage.fields.args[0]
|
let ChatMessage = _ChatMessage.fields.args[0]
|
||||||
ChatMessage = this.fix_updatedAt(ChatMessage)
|
ChatMessage = this.fix_updatedAt(ChatMessage)
|
||||||
|
|
||||||
|
if(!this.messagesLocalReference.includes(ChatMessage.localReference)) {
|
||||||
const message = this.prepareMessage(ChatMessage)
|
const message = this.prepareMessage(ChatMessage)
|
||||||
this.lastMessage = message
|
this.lastMessage = message
|
||||||
this.calDateDuration(ChatMessage._updatedAt)
|
this.calDateDuration(ChatMessage._updatedAt)
|
||||||
@@ -121,7 +121,8 @@ export class RoomService {
|
|||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.scrollDown()
|
this.scrollDown()
|
||||||
}, 50)
|
}, 50)
|
||||||
}, 150)
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -404,9 +405,12 @@ export class RoomService {
|
|||||||
} else {
|
} else {
|
||||||
if(environment.chatOffline) alert('create offline')
|
if(environment.chatOffline) alert('create offline')
|
||||||
const offlineMessage = this.prepareMessage(ChatMessage)
|
const offlineMessage = this.prepareMessage(ChatMessage)
|
||||||
|
|
||||||
|
this.messagesLocalReference.push(offlineMessage.localReference)
|
||||||
offlineMessage.send().then(()=>{
|
offlineMessage.send().then(()=>{
|
||||||
this.updateMessageDB(ChatMessage, ChatMessage.localReference)
|
this.updateMessageDB(ChatMessage, ChatMessage.localReference)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -437,7 +441,7 @@ export class RoomService {
|
|||||||
await chatHistory.result.messages.reverse().forEach( async (message) => {
|
await chatHistory.result.messages.reverse().forEach( async (message) => {
|
||||||
|
|
||||||
this.prepareMessage(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.setData(message)
|
||||||
wewMessage.loadHistory = this.hasLoadHistory
|
wewMessage.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
if(!message._id && environment.chatOffline) {
|
if(!message._id && environment.chatOffline && save) {
|
||||||
if(this.hasLoadHistory && environment.chatOffline) alert('create offline')
|
if(this.hasLoadHistory && environment.chatOffline) alert('create offline')
|
||||||
|
|
||||||
this.messages.push(wewMessage)
|
this.messages.push(wewMessage)
|
||||||
|
|||||||
@@ -158,14 +158,16 @@ export class WsChatService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send message to room
|
// 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 = {
|
var message = {
|
||||||
msg: "method",
|
msg: "method",
|
||||||
method: "sendMessage",
|
method: "sendMessage",
|
||||||
id: requestId,
|
id: requestId,
|
||||||
params: [{
|
params: [{
|
||||||
rid: roomId,
|
rid: roomId,
|
||||||
|
localReference: localReference,
|
||||||
msg: msg,
|
msg: msg,
|
||||||
attachments,
|
attachments,
|
||||||
file
|
file
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
<div class="header-top">
|
<div class="header-top">
|
||||||
<div class="middle">
|
<div class="middle">
|
||||||
<ion-label class="title">{{ wsChatMethodsService.getDmRoom(roomId).name }}</ion-label>
|
<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> -->
|
<!-- <span><ion-icon class="{{users.status}}" name="ellipse"></ion-icon></span> -->
|
||||||
</div>
|
</div>
|
||||||
<div hidden class="right">
|
<div hidden class="right">
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export const environment = {
|
|||||||
domain: 'gabinetedigital.local', //gabinetedigital.local
|
domain: 'gabinetedigital.local', //gabinetedigital.local
|
||||||
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
||||||
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||||
chatOffline: false
|
chatOffline: true
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user