diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index 0fc332fb6..063e1a804 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -95,29 +95,30 @@ export class RoomService { (_ChatMessage) => { console.log('recivemessage', _ChatMessage) - let ChatMessage = _ChatMessage.fields.args[0] - ChatMessage = this.fix_updatedAt(ChatMessage) - alert('receive') - const message = this.prepareMessage(ChatMessage) - this.lastMessage = message - this.calDateDuration(ChatMessage._updatedAt) - - if (message.t == 'r') { - this.name = message.msg - } - - if(this.isSenderIsNotMe(ChatMessage)) { - this.NativeNotificationService.sendNotificationChat({ - message: message.msg, - title: this.name - }); - } - - this.addMessageDB(ChatMessage) - setTimeout(()=>{ - this.scrollDown() - }, 50) + let ChatMessage = _ChatMessage.fields.args[0] + ChatMessage = this.fix_updatedAt(ChatMessage) + const message = this.prepareMessage(ChatMessage) + this.lastMessage = message + this.calDateDuration(ChatMessage._updatedAt) + + if (message.t == 'r') { + this.name = message.msg + } + + if(this.isSenderIsNotMe(ChatMessage)) { + this.NativeNotificationService.sendNotificationChat({ + message: message.msg, + title: this.name + }); + } + + this.addMessageDB(ChatMessage) + + setTimeout(()=>{ + this.scrollDown() + }, 50) + }, 150) } ) @@ -393,7 +394,6 @@ export class RoomService { if(wewMessage.offline == false) { this.prepareMessage(ChatMessage) } else { - alert('create offline') const offlineMessage = this.prepareMessage(ChatMessage) offlineMessage.send().then(()=>{ this.updateMessageDB(ChatMessage, ChatMessage.localReference) @@ -451,7 +451,6 @@ export class RoomService { wewMessage.loadHistory = this.hasLoadHistory if(!message._id && environment.chatOffline) { - if(this.hasLoadHistory) alert('create offline') this.messages.push(wewMessage) return wewMessage @@ -467,7 +466,6 @@ export class RoomService { }) if (save && !found) { - if(this.hasLoadHistory) alert('not found') this.messages.push(wewMessage) } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 6bf93dabc..cd809f519 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -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 }; /*