2

I've built a chat feature into my app using the JSQMessagesViewController library and Firebase. There is a tableView of conversations that include labels for the username and lastMessage received from that user. Currently, I am displaying a small dot and changing the lastMessage label's font to bold when there is an unread message in the conversation. I've implemented a method for indicating unread messages, but I know the method is incorrect:

When a message is sent by User A, a direct child of the conversation called readMessage is updated in Firebase with the value NO. Then when User B selects the conversation row I'm using didSelectRowAtIndexPath to update readMessage to YES. This is causing obvious problems though because if User A sends a message, the conversation shows up unread for both users, not just User B.

How do I properly accomplish this so that new messages are only shown as unread to the user receiving the message?

Austin Berenyi
  • 1,013
  • 2
  • 13
  • 25

0 Answers0