Refactor: Introduce video message record mode
This commit refactors the `ActionMode` sealed class into an enum and adds a new `RECORD_VIDEO` state. This allows for distinct actions for recording audio and video messages.
Specifically, the following changes were made:
- Converted `ActionMode` from a sealed class to an enum.
- Added `RECORD_VIDEO` to `ActionMode`.
- Updated `MessagesHistoryInputBar` to:
- Animate the action button icon change between record modes.
- Remove the shake animation from emoji, attachment, and mic buttons.
- Updated `MessagesHistoryViewModel` to toggle between `RECORD_AUDIO` and `RECORD_VIDEO` when the action button is clicked in a record mode.
- Added support for displaying `VIDEO_MESSAGE` attachments in `Attachments.kt`, including an animated circular preview.
- Updated `MessageBubble` to render video messages without a background, similar to stickers.
- Added `image` property to `VkVideoMessageDomain` to hold the URL for the video message preview.
- Added a new drawable `rounded_photo_camera_24` for the video record button.
- Updated `VkVideoMessageData` to parse and provide the square preview image URL to the domain model.
This commit is contained in:
@@ -54,9 +54,9 @@ data class VkVideoMessageData(
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Image(
|
||||
val height: Int?,
|
||||
val url: String?,
|
||||
val width: Int?,
|
||||
val height: Int,
|
||||
val url: String,
|
||||
val width: Int,
|
||||
val with_padding: Int?,
|
||||
)
|
||||
|
||||
@@ -73,6 +73,7 @@ data class VkVideoMessageData(
|
||||
)
|
||||
|
||||
fun toDomain(): VkVideoMessageDomain = VkVideoMessageDomain(
|
||||
id = id
|
||||
id = id,
|
||||
image = image.orEmpty().filter { it.width / it.height == 1 }.maxByOrNull { it.width }?.url
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ package dev.meloda.fast.model.api.domain
|
||||
import dev.meloda.fast.model.api.data.AttachmentType
|
||||
|
||||
data class VkVideoMessageDomain(
|
||||
val id: Long
|
||||
val id: Long,
|
||||
val image: String?
|
||||
) : VkAttachment {
|
||||
|
||||
override val type: AttachmentType = AttachmentType.VIDEO_MESSAGE
|
||||
|
||||
Reference in New Issue
Block a user