Please help with the following problem:
I’m making a chat application. To notify users about new messages, I use Expo.Notifications module. But how can I stop showing new push notifications for the user who has already opened the chat (already talking with another user)?
That is, the user who opened the chat does not need to see notifications that he has a new message, because he immediately sees the message.
I checked the source code of the Expo.Notifications module, but I did not understand how to prevent notifications to appear by some condition. There is a function called
.addListener(), which argument is the event handler for the notification that recieved, but the problem is that this handler fires after the notification was alreay shown. So the user sees new notification every time.
I have a feeling that I do not understand some very simple concept… It would be great if someone will help)