forked from melod1n/fast-messenger
feat(messages): Implement "message read by" counter
This commit introduces the ability to see how many people have read an outgoing message in a group chat. A "views" count is now displayed in the message options dialog for relevant messages. - **API & Data Layer:** - Added `getMessageReadPeers` to `MessagesService` and `MessagesRepository` to fetch users who have read a specific message. - Introduced `MessagesGetReadPeersResponse` to handle the API response. - A new URL constant `GET_MESSAGE_READ_PEERS` was added. - **Domain Layer:** - A new `GetMessageReadPeersUseCase` is created to provide the view count to the ViewModel. - The use case is registered in the `DomainModule`. - **ViewModel:** - `MessagesHistoryViewModel` now includes `loadMessageReadPeers` to asynchronously fetch and return the view count for a message. - **UI (Compose):** - The `MessageOptionsDialog` now displays a "views" count for outgoing chat messages. - It uses a `LaunchedEffect` to call `loadMessageReadPeers` when the dialog is shown. - The `visibility` icon has been updated and its XML file renamed to `round_visibility_24px.xml` to follow a consistent naming convention. - **Refactoring & Minor Fixes:** - Simplified several `derivedStateOf` usages to direct calculations or property delegates in `MessageBubble.kt` and `MessagesList.kt` for minor performance improvements. - Renamed `IncomingMessageBubble.kt` and `OutgoingMessageBubble.kt` to `MessageBubbleIncoming.kt` and `MessageBubbleOutgoing.kt` respectively for consistency. - Removed an unnecessary log statement in `MessagesList.kt`.
This commit is contained in:
@@ -70,3 +70,10 @@ data class MessagesMarkAsImportantResponse(
|
||||
@Json(name = "peer_id") val peerId: Long
|
||||
)
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class MessagesGetReadPeersResponse(
|
||||
@Json(name = "items") val items: List<Long>,
|
||||
@Json(name = "total_count") val totalCount: Int,
|
||||
@Json(name = "profiles") val profiles: List<VkUserData>?,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user