mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
save merge
This commit is contained in:
@@ -127,7 +127,7 @@ export class AuthService {
|
||||
|
||||
this.loginToChatWs()
|
||||
|
||||
console.log('Login to Rocket chat OK');
|
||||
console.log('Login to Rocket chat OK', responseChat);
|
||||
this.ValidatedUserChat = responseChat;
|
||||
localStorage.setItem('userChat', JSON.stringify(responseChat));
|
||||
this.storageService.store(AuthConnstants.AUTH, responseChat);
|
||||
|
||||
@@ -91,33 +91,39 @@ export class RoomService {
|
||||
this.id,
|
||||
"stream-room-messages",
|
||||
(ChatMessage) => {
|
||||
ChatMessage = ChatMessage.fields.args[0]
|
||||
|
||||
ChatMessage = this.fix_updatedAt(ChatMessage)
|
||||
// console.log('recivemessage', ChatMessage)
|
||||
setTimeout(()=>{
|
||||
ChatMessage = ChatMessage.fields.args[0]
|
||||
|
||||
const messageIsFound = this.messages.find((message) => {
|
||||
message._id == ChatMessage._id
|
||||
})
|
||||
|
||||
if(!messageIsFound) {
|
||||
const message = this.prepareMessage(ChatMessage)
|
||||
|
||||
this.lastMessage = message
|
||||
if (message.t == 'r') { this.name = message.msg }
|
||||
this.calDateDuration(ChatMessage._updatedAt)
|
||||
ChatMessage = this.fix_updatedAt(ChatMessage)
|
||||
// console.log('recivemessage', ChatMessage)
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollDown()
|
||||
}, 100)
|
||||
const messageIsFound = this.messages.find((message) => {
|
||||
return message._id == ChatMessage._id
|
||||
})
|
||||
|
||||
this.NativeNotificationService.sendNotificationChat({
|
||||
message: message.msg,
|
||||
title: this.name
|
||||
});
|
||||
|
||||
this.addMessageDB(ChatMessage)
|
||||
}
|
||||
if(!messageIsFound) {
|
||||
console.log('messageIsFound', messageIsFound)
|
||||
const message = this.prepareMessage(ChatMessage)
|
||||
|
||||
this.lastMessage = message
|
||||
if (message.t == 'r') { this.name = message.msg }
|
||||
this.calDateDuration(ChatMessage._updatedAt)
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollDown()
|
||||
}, 100)
|
||||
|
||||
this.NativeNotificationService.sendNotificationChat({
|
||||
message: message.msg,
|
||||
title: this.name
|
||||
});
|
||||
|
||||
this.addMessageDB(ChatMessage)
|
||||
} else {
|
||||
console.log('have')
|
||||
}
|
||||
}, 150)
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
@@ -666,7 +666,7 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
|
||||
if (this.ws.connected == false || loginRequired == true && this.isLogin == false) { // save data to send when back online
|
||||
// console.log('save msgQueue this.ws.connected == false || loginRequired == true && this.isLogin == false',this.ws.connected, loginRequired, this.isLogin)
|
||||
console.log('save msgQueue', requestId, message)
|
||||
//console.log('save msgQueue', requestId, message)
|
||||
|
||||
this.wsMsgQueue[requestId] = {message, requestId, loginRequired}
|
||||
} else {
|
||||
@@ -679,8 +679,6 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
onmessage: async (event: any)=> {
|
||||
const data = JSON.parse(event.data)
|
||||
|
||||
console.log('data', data)
|
||||
|
||||
for (const [key, value] of Object.entries(this.wsCallbacks)) {
|
||||
if(value.type== 'Onmessage') {
|
||||
const dontRepeat = await value.funx(data)
|
||||
|
||||
Reference in New Issue
Block a user