rpaschoal / ng-chat

💬 A simple facebook/linkedin lookalike chat module for Angular applications.
MIT License
155 stars 92 forks source link

Unseen Messages Trigger #72

Closed FShieldheart-zz closed 5 years ago

FShieldheart-zz commented 5 years ago

Hello There,

Thanks for the great chat application, helps me a lot. I would like to talk about a strange behavior. I do not know if it is just for me or if it is a normal one but here it is:

When a user received a message from another user (both of them are online), the receiver has a pop up opened for the new message. Everything is great up to this. But, onMessagesSeen method (I am using it for persisting the read status to a database), "messages" parameter is always empty unless the receiver specifically closes the chat window, reopen it and click on the message text box. Then the messages are filled for the method. This is not a desirable behavior for me.

Am I missing something? Is this a normal behavior? How can I find a way around?

Thanks in advance.

FS

rpaschoal commented 5 years ago

Hi @FShieldheart ,

Glad to know the application is useful to you! 😸

This might be a bug. Would you be able to get some minimal code running somewhere displaying this behavior so I can have a look?

Cheers!

rpaschoal commented 5 years ago

Hello again @FShieldheart ,

I can confirm this is a bug and I've just fixed it for the next release on this commit: https://github.com/rpaschoal/ng-chat/commit/e1a2a1bc77232185a5f0cdd03b19a44724f00513

I'll leave the issue open and update you as soon as the new release with the fix is on NPM.

Cheers!

FShieldheart-zz commented 5 years ago

Hello @rpaschoal!

First of all, I am very sorry for not supplying you with the demonstration of the bug but I was on a very tight schedule. The main system is in a closed environment so I did not have the chance to supply you a real-world demonstration either. Again, sorry for that.

I would like to thank you for fixing the bug as your component is an important part of the system I was talking about.

Thanks!

FS

rpaschoal commented 5 years ago

No worries @FShieldheart! Make sure you keep an eye on this issue as I will update you here when the new release is out, cheers!

MuhammadRizwanBashir commented 5 years ago

@rpaschoal How i can get call when onMessagesSeen event triggered. how to implement this in my adapter or component, any sample code.(i want to mark them read in my database). thanks in advance.

rpaschoal commented 5 years ago

Hi @MuhammadRizwanBashir , I've opened a new issue to discuss your question: #75

@FShieldheart You are more than welcome to help and give some suggestions on how you have implemented this yourself. Cheers!

rpaschoal commented 5 years ago

@FShieldheart I've just released version 1.1.0 with bug fixes I believe are related to this. Would you be able to test it again and confirm if this is still an issue? Cheers!

FShieldheart-zz commented 5 years ago

@rpaschoal Thank you very much! I will try and report to you back as soon as possible!

FShieldheart-zz commented 5 years ago

@MuhammadRizwanBashir Here what I did in my project. I wrote a service and injected into my component which has the "onMessagesSeen" method. This service uses an API to persist unread messages as read in the data store. Also, the same API sends a signal to the receiver via SignalR upon successful completion of the transaction so that sender is notified of the messages which have read (assuming sender is online at the time of this flow). Hope it helps.

rpaschoal commented 5 years ago

Thanks for the info @FShieldheart , will paste your message at the other issue I raised on this topic #75

rpaschoal commented 5 years ago

Hi @FShieldheart ,

Any updates on this?

rpaschoal commented 5 years ago

@FShieldheart Closing this as I haven't heard back from you and the fix has been released. Feel free to reopen the issue if it is still happening.

FShieldheart-zz commented 5 years ago

Hi @rpaschoal,

Sorry for the latest response! The bug has been fixed and working exactly as it should be!

Thanks again!

FS