Fixed chat message not marked as reply when replying with more than 1 content in a basic chat room
This commit is contained in:
parent
a8d8690d92
commit
ae54179976
2 changed files with 14 additions and 7 deletions
|
@ -30,6 +30,7 @@ Group changes to describe their impact on the project, as follows:
|
||||||
### Fixed
|
### Fixed
|
||||||
- Plain copy of encrypted files (when VFS is enabled) not cleaned
|
- Plain copy of encrypted files (when VFS is enabled) not cleaned
|
||||||
- Avatar display issue if contact's "initials" contains more than 1 emoji or an emoji + a character
|
- Avatar display issue if contact's "initials" contains more than 1 emoji or an emoji + a character
|
||||||
|
- Messages not marked as reply in basic chat room if sending more than 1 content
|
||||||
|
|
||||||
## [5.0.9] - 2023-03-30
|
## [5.0.9] - 2023-03-30
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,14 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createChatMessage(): ChatMessage {
|
||||||
|
val pendingMessageToReplyTo = pendingChatMessageToReplyTo.value
|
||||||
|
return if (isPendingAnswer.value == true && pendingMessageToReplyTo != null)
|
||||||
|
chatRoom.createReplyMessage(pendingMessageToReplyTo.chatMessage)
|
||||||
|
else
|
||||||
|
chatRoom.createEmptyMessage()
|
||||||
|
}
|
||||||
|
|
||||||
fun sendMessage() {
|
fun sendMessage() {
|
||||||
if (!isPlayerClosed()) {
|
if (!isPlayerClosed()) {
|
||||||
stopVoiceRecordPlayer()
|
stopVoiceRecordPlayer()
|
||||||
|
@ -234,11 +242,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
stopVoiceRecorder()
|
stopVoiceRecorder()
|
||||||
}
|
}
|
||||||
|
|
||||||
val pendingMessageToReplyTo = pendingChatMessageToReplyTo.value
|
val message = createChatMessage()
|
||||||
val message: ChatMessage = if (isPendingAnswer.value == true && pendingMessageToReplyTo != null)
|
|
||||||
chatRoom.createReplyMessage(pendingMessageToReplyTo.chatMessage)
|
|
||||||
else
|
|
||||||
chatRoom.createEmptyMessage()
|
|
||||||
val isBasicChatRoom: Boolean = chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
|
val isBasicChatRoom: Boolean = chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
|
||||||
|
|
||||||
var voiceRecord = false
|
var voiceRecord = false
|
||||||
|
@ -259,7 +263,8 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
val toSend = textToSend.value.orEmpty().trim()
|
val toSend = textToSend.value.orEmpty().trim()
|
||||||
if (toSend.isNotEmpty()) {
|
if (toSend.isNotEmpty()) {
|
||||||
if (voiceRecord && isBasicChatRoom) {
|
if (voiceRecord && isBasicChatRoom) {
|
||||||
val textMessage: ChatMessage = chatRoom.createMessageFromUtf8(toSend)
|
val textMessage = createChatMessage()
|
||||||
|
textMessage.addUtf8TextContent(toSend)
|
||||||
textMessage.send()
|
textMessage.send()
|
||||||
} else {
|
} else {
|
||||||
message.addUtf8TextContent(toSend)
|
message.addUtf8TextContent(toSend)
|
||||||
|
@ -282,7 +287,8 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
// Do not send file in the same message as the text in a BasicChatRoom
|
// Do not send file in the same message as the text in a BasicChatRoom
|
||||||
// and don't send multiple files in the same message if setting says so
|
// and don't send multiple files in the same message if setting says so
|
||||||
if (isBasicChatRoom or (corePreferences.preventMoreThanOneFilePerMessage and (fileContent or voiceRecord))) {
|
if (isBasicChatRoom or (corePreferences.preventMoreThanOneFilePerMessage and (fileContent or voiceRecord))) {
|
||||||
val fileMessage: ChatMessage = chatRoom.createFileTransferMessage(content)
|
val fileMessage = createChatMessage()
|
||||||
|
fileMessage.addFileContent(content)
|
||||||
fileMessage.send()
|
fileMessage.send()
|
||||||
} else {
|
} else {
|
||||||
message.addFileContent(content)
|
message.addFileContent(content)
|
||||||
|
|
Loading…
Reference in a new issue