Fixed some chat related issues
This commit is contained in:
parent
a221e1fdbb
commit
a284a55d8e
2 changed files with 9 additions and 4 deletions
|
@ -24,7 +24,10 @@ import androidx.lifecycle.ViewModel
|
|||
import androidx.lifecycle.ViewModelProvider
|
||||
import java.io.File
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.core.*
|
||||
import org.linphone.core.ChatMessage
|
||||
import org.linphone.core.ChatRoom
|
||||
import org.linphone.core.ChatRoomCapabilities
|
||||
import org.linphone.core.Factory
|
||||
import org.linphone.utils.FileUtils
|
||||
|
||||
class ChatMessageSendingViewModelFactory(private val chatRoom: ChatRoom) :
|
||||
|
@ -103,7 +106,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
|||
|
||||
val toSend = textToSend.value
|
||||
if (toSend != null && toSend.isNotEmpty()) {
|
||||
message.addTextContent(toSend)
|
||||
message.addUtf8TextContent(toSend)
|
||||
}
|
||||
|
||||
for (attachment in attachments.value.orEmpty()) {
|
||||
|
|
|
@ -89,7 +89,7 @@ class ChatMessagesListViewModel(private val chatRoom: ChatRoom) : ViewModel() {
|
|||
addEvent(eventLog)
|
||||
}
|
||||
|
||||
override fun onChatMessageSent(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
override fun onChatMessageSending(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
val position = events.value.orEmpty().size
|
||||
|
||||
if (eventLog.type == EventLog.Type.ConferenceChatMessage) {
|
||||
|
@ -208,7 +208,9 @@ class ChatMessagesListViewModel(private val chatRoom: ChatRoom) : ViewModel() {
|
|||
private fun addEvent(eventLog: EventLog) {
|
||||
val list = arrayListOf<EventLog>()
|
||||
list.addAll(events.value.orEmpty())
|
||||
if (!list.contains(eventLog)) {
|
||||
list.add(eventLog)
|
||||
}
|
||||
events.value = list
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue