From 52b5a81c2680c93ebc502e0f9c1b51c98512cb9b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 18 Oct 2023 15:43:24 +0200 Subject: [PATCH] Fixed sent content type --- .../chat/viewmodels/ChatMessageSendingViewModel.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/linphone/activities/main/chat/viewmodels/ChatMessageSendingViewModel.kt b/app/src/main/java/org/linphone/activities/main/chat/viewmodels/ChatMessageSendingViewModel.kt index 56ec7665e..9649aafc0 100644 --- a/app/src/main/java/org/linphone/activities/main/chat/viewmodels/ChatMessageSendingViewModel.kt +++ b/app/src/main/java/org/linphone/activities/main/chat/viewmodels/ChatMessageSendingViewModel.kt @@ -287,10 +287,12 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel() for (attachment in attachments.value.orEmpty()) { val content = Factory.instance().createContent() - if (attachment.isImage) { - content.type = "image" - } else { - content.type = "file" + content.type = when { + attachment.isImage -> "image" + attachment.isAudio -> "audio" + attachment.isVideo -> "video" + attachment.isPdf -> "application" + else -> "file" } content.subtype = FileUtils.getExtensionFromFileName(attachment.fileName) content.name = attachment.fileName