teste/route

This commit is contained in:
Peter Maquiran
2022-02-16 15:52:59 +01:00
parent 1efea5bdf7
commit 439332a52e
35 changed files with 309 additions and 286 deletions
+54 -3
View File
@@ -18,7 +18,13 @@ export class MessageService {
msg = ''
rid = ''
ts = {}
u = {}
u = {
name: '',
username: '',
_id: ""
}
t = ''
_id =''
_updatedAt
@@ -35,6 +41,8 @@ export class MessageService {
loadHistory = false
duration = ''
localReference = null
viewed = []
received = []
constructor(private storage: Storage,
private NfService: NfService,
@@ -78,6 +86,7 @@ export class MessageService {
}
}
this.calDateDuration()
}
@@ -140,9 +149,9 @@ export class MessageService {
console.log('message', message)
let ChatMessage = message.result
if (environment.chatOffline) {
// this.redefinedMessage(ChatMessage)
this.redefinedMessage(ChatMessage)
this.offline = false
}
@@ -189,5 +198,47 @@ export class MessageService {
this.duration = showDateDuration(date || this._updatedAt);
}
private messageReceptor() {
return this.u.username != SessionStore.user.RochetChatUser
}
receptorReceive() {
if(this.messageReceptor()) {
let newMessage = {
rid: this._id,
msg: this.msg,
attachments: this.attachments,
file: this.file,
localReference: this.localReference,
viewed: this.viewed.push('123'),
received: this.viewed.push('123'),
}
this.WsChatService.updateMessage(newMessage).then(()=>{
console.log('newMessage', newMessage)
})
}
}
receptorView() {
if(this.messageReceptor()) {
let newMessage = {
rid: this._id,
msg: this.msg,
attachments: this.attachments,
file: this.file,
localReference: this.localReference,
viewed: this.viewed.push('123'),
received: this.viewed.push('123'),
}
this.WsChatService.updateMessage(newMessage).then(()=>{
console.log('newMessage', newMessage)
})
}
}
}