Various improvements

This commit is contained in:
Sylvain Berfini 2025-06-13 09:20:01 +02:00
parent 8ae0f5a51a
commit ab3710f4ce
5 changed files with 35 additions and 38 deletions

View file

@ -36,7 +36,7 @@ Linphone is dual licensed, and is available either :
6.0.0 release is a completely new version, designed with UX/UI experts and marks a turning point in design, features, and user experience. The improvements make this version smoother and simpler for both developers and users.
You can take a look at the [CHANGELOG.md](CHANGELOG.md) file for a non-exhaustive list of changes of this new version and of the newly added features, the most exciting ones being the improved fluidity, a real multi-accounts support and asymetrical video in calls.
You can take a look at the [CHANGELOG.md](CHANGELOG.md) file for a non-exhaustive list of changes of this new version and of the newly added features, the most exciting ones being the improved fluidity, a real multi-accounts support and asymmetrical video in calls.
This release only works on Android OS 9.0 and newer.

View file

@ -107,6 +107,7 @@ class ConversationModel
}
}
@WorkerThread
override fun onConferenceJoined(chatRoom: ChatRoom, eventLog: EventLog) {
// This is required as a Created chat room may not have the participants list yet
Log.i("$TAG Conversation has been joined")
@ -129,10 +130,12 @@ class ConversationModel
computeComposingLabel()
}
@WorkerThread
override fun onNewEvent(chatRoom: ChatRoom, eventLog: EventLog) {
updateLastUpdatedTime()
}
@WorkerThread
override fun onNewEvents(chatRoom: ChatRoom, eventLogs: Array<out EventLog>) {
updateLastMessage()
updateLastUpdatedTime()
@ -340,14 +343,13 @@ class ConversationModel
val message = chatRoom.lastMessageInHistory
if (message != null) {
lastMessage = message
updateLastMessageStatus(message)
if (message.isOutgoing && message.state != ChatMessage.State.Displayed) {
message.addListener(chatMessageListener)
lastMessage = message
} else if (message.contents.find { it.isFileTransfer == true } != null) {
message.addListener(chatMessageListener)
lastMessage = message
}
val timestamp = message.time

View file

@ -20,10 +20,7 @@
package org.linphone.ui.main.chat.model
import androidx.annotation.WorkerThread
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.EventLog
import org.linphone.core.tools.Log
import org.linphone.utils.LinphoneUtils
class EventLogModel
@WorkerThread
@ -54,35 +51,10 @@ class EventLogModel
EventModel(eventLog)
} else {
val chatMessage = eventLog.chatMessage!!
var replyTo = ""
var isReply = chatMessage.isReply
val replyText = if (chatMessage.isReply) {
val replyMessage = chatMessage.replyMessage
if (replyMessage != null) {
val from = replyMessage.fromAddress
val avatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(from)
replyTo = avatarModel.contactName ?: LinphoneUtils.getDisplayName(from)
LinphoneUtils.getPlainTextDescribingMessage(replyMessage)
} else {
Log.e(
"$TAG Failed to find the reply message from ID [${chatMessage.replyMessageId}]"
)
isReply = false
""
}
} else {
""
}
MessageModel(
chatMessage,
isFromGroup,
isReply,
replyTo,
replyText,
chatMessage.replyMessageId,
chatMessage.isForward,
isGroupedWithPreviousOne,
isGroupedWithNextOne,
currentFilter,

View file

@ -70,11 +70,6 @@ class MessageModel
constructor(
val chatMessage: ChatMessage,
val isFromGroup: Boolean,
val isReply: Boolean,
val replyTo: String,
val replyText: String,
val replyToMessageId: String?,
val isForward: Boolean,
isGroupedWithPreviousOne: Boolean,
isGroupedWithNextOne: Boolean,
private val currentFilter: String = "",
@ -116,6 +111,16 @@ class MessageModel
)?.params?.instantMessagingEncryptionMandatory == true
)
val isReply = chatMessage.isReply
val replyToMessageId = chatMessage.replyMessageId
val isForward = chatMessage.isForward
val replyTo = MutableLiveData<String>()
val replyText = MutableLiveData<Spannable>()
val avatarModel = MutableLiveData<ContactAvatarModel>()
val groupedWithNextMessage = MutableLiveData<Boolean>()
@ -314,6 +319,9 @@ class MessageModel
updateReactionsList()
computeContentsList()
if (isReply) {
computeReplyInfo()
}
coreContext.postOnMainThread {
firstFileModel.addSource(filesList) {
@ -629,6 +637,19 @@ class MessageModel
}
}
@WorkerThread
fun computeReplyInfo() {
val replyMessage = chatMessage.replyMessage
if (replyMessage != null) {
val from = replyMessage.fromAddress
val avatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(from)
replyTo.postValue(avatarModel.contactName ?: LinphoneUtils.getDisplayName(from))
replyText.postValue(LinphoneUtils.getFormattedTextDescribingMessage(replyMessage))
} else {
Log.e("$TAG Failed to find the reply message from ID [${chatMessage.replyMessageId}]")
}
}
@WorkerThread
private fun computeTextContent(content: Content, highlight: String) {
val textContent = content.utf8Text.orEmpty().trim()

View file

@ -139,7 +139,8 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/color_separator"/>
android:background="?attr/color_separator"
android:visibility="@{viewModel.isChatRoomReadOnly ? View.GONE : View.VISIBLE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/popup_menu_action_label_style"
@ -170,7 +171,8 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/color_separator"/>
android:background="?attr/color_separator"
android:visibility="@{viewModel.hideForward ? View.GONE : View.VISIBLE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/popup_menu_danger_action_label_style"