From 47fd5e3895d9a48b8d28078de92de53e7bcda7ce Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 3 Feb 2022 15:52:21 +0100 Subject: [PATCH] receive message --- nice.html | 49 +++++++++++++++++++++++++++ src/app/services/auth.service.ts | 2 +- src/app/services/chat/room.service.ts | 19 ++++++----- 3 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 nice.html diff --git a/nice.html b/nice.html new file mode 100644 index 000000000..9e964f49f --- /dev/null +++ b/nice.html @@ -0,0 +1,49 @@ + + + + + + + Document + + + + + + + \ No newline at end of file diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index f26ca9f5e..9167fa75d 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -131,7 +131,7 @@ export class AuthService { localStorage.setItem('userChat', JSON.stringify(responseChat)); this.storageService.store(AuthConnstants.AUTH, responseChat); - this.autologout(10000); + // this.autologout(10000); return true; diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index 2f2e4645d..a3c58eaed 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -77,6 +77,11 @@ export class RoomService { this.calDateDuration() } + + isSenderIsNotMe(ChatMessage) { + return SessionStore.user.RochetChatUser != ChatMessage.u.username + } + receiveMessage() { this.WsChatService.updateRoomEventss( @@ -84,7 +89,7 @@ export class RoomService { "stream-room-messages", (ChatMessage) => { - if(environment.chatOffline == false) { + if(environment.chatOffline == false || this.isSenderIsNotMe(ChatMessage)) { ChatMessage = ChatMessage.fields.args[0] ChatMessage = this.fix_updatedAt(ChatMessage) console.log('recivemessage', ChatMessage) @@ -99,14 +104,10 @@ export class RoomService { this.scrollDown() }, 100) - //this.sortService.sortDate(this.messages, '') - - if(SessionStore.user.RochetChatUser != ChatMessage.u.username) { - this.NativeNotificationService.sendNotificationChat({ - message: message.msg, - title: this.name - }); - } + this.NativeNotificationService.sendNotificationChat({ + message: message.msg, + title: this.name + }); this.addMessageDB(ChatMessage)