ConversationDao

interface ConversationDao

Data Access Object for Conversation entities.

Provides methods to query, insert, and update conversations in the Room database.

Functions

Link copied to clipboard
abstract suspend fun clearUnreadCount(conversationId: String)

Clears the unread message count for a specific conversation, setting it to 0.

Link copied to clipboard

Returns a flow of all conversations, sorted by the timestamp of the last message in descending order.

Link copied to clipboard
abstract suspend fun getConversationById(conversationId: String): Conversation?

Retrieves a conversation by its unique ID.

Link copied to clipboard
abstract suspend fun getConversationByUserUuid(userUuid: String): Conversation?

Retrieves a conversation associated with a specific user UUID.

Link copied to clipboard
abstract suspend fun incrementUnreadCount(conversationId: String)

Increments the unread message count for a specific conversation by 1.

Link copied to clipboard
abstract suspend fun insertConversation(conversation: Conversation)

Inserts a new conversation into the database.

Link copied to clipboard
abstract suspend fun updateConversation(conversation: Conversation)

Updates an existing conversation in the database.

Link copied to clipboard
abstract suspend fun updateLastMessage(conversationId: String, lastMessage: String, timestamp: Long)

Updates the last message and its timestamp for a specific conversation.

Link copied to clipboard
abstract suspend fun updateUserConnectionStatus(userUuid: String, isOnline: Boolean, userAddress: String?)

Updates the online status and user address for a conversation based on the user UUID.