Skip to main content

Chatroom

Documentation for Chatroom features

📄️ Get Unread Chatrooms

The getUnreadChatrooms function retrieves a list of unread chatrooms from the local database using Realm. It accepts a Chatroom and the lastConversation as input, updating or creating relevant records within the local database. If the chatroom exists, it updates the unseenCount, unreadConversationsCount, and conversation details. If the chatroom is not found, it creates new chatroom, conversation, and member records. The method filters chatrooms with active follow status, no mute status, and unseen messages, then sorts them by the latest conversation timestamp. It returns a maximum of 7 chatrooms wrapped in an LMResponse.