Отправка гиф

This commit is contained in:
Халимов Рустам
2026-04-14 13:55:01 +03:00
parent 8ce4bc714f
commit 8165b74e43
16 changed files with 117 additions and 15 deletions
@@ -32,8 +32,17 @@ class ChatRepositoryImpl @Inject constructor(
return api.getMessages(chatId).map { it.toDomain(baseUrl) }
}
override suspend fun sendMessage(chatId: String, content: String): Message {
val request = SendMessageRequest(content = content, type = "text")
override suspend fun sendMessage(
chatId: String,
content: String?,
type: String,
attachments: List<chats.data.remote.api.AttachmentRequest>?
): Message {
val request = SendMessageRequest(
content = content,
type = type,
attachments = attachments
)
val baseUrl = serverConfig.getBaseUrl().removeSuffix("/api/")
return api.sendMessage(chatId, request).toDomain(baseUrl)
}
@@ -91,6 +100,7 @@ fun ChatDto.toDomain(currentUserId: String, baseUrl: String): Chat {
fun MessageDto.toDomain(baseUrl: String): Message {
val domainMediaType = when (type) {
"gif" -> MediaType.GIF
"image", "photo" -> MediaType.IMAGE
"video" -> MediaType.VIDEO
"audio", "voice" -> MediaType.AUDIO