mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Display last message timestamp in conversations list instead of chat room last updated timestamp
This commit is contained in:
parent
85679dcc43
commit
fea1dbe5ca
1 changed files with 15 additions and 12 deletions
|
|
@ -349,12 +349,27 @@ class ConversationModel
|
|||
message.addListener(chatMessageListener)
|
||||
lastMessage = message
|
||||
}
|
||||
|
||||
val timestamp = message.time
|
||||
val humanReadableTimestamp = when {
|
||||
TimestampUtils.isToday(timestamp) -> {
|
||||
TimestampUtils.timeToString(timestamp)
|
||||
}
|
||||
TimestampUtils.isYesterday(timestamp) -> {
|
||||
AppUtils.getString(R.string.yesterday)
|
||||
}
|
||||
else -> {
|
||||
TimestampUtils.toString(timestamp, onlyDate = true)
|
||||
}
|
||||
}
|
||||
dateTime.postValue(humanReadableTimestamp)
|
||||
} else {
|
||||
lastMessage = null
|
||||
lastMessageTextSender.postValue("")
|
||||
lastMessageContentIcon.postValue(0)
|
||||
lastMessageText.postValue(SpannableStringBuilder("").toSpannable())
|
||||
isLastMessageOutgoing.postValue(false)
|
||||
dateTime.postValue("")
|
||||
Log.w("$TAG No last message to display for conversation [$id]")
|
||||
}
|
||||
}
|
||||
|
|
@ -362,18 +377,6 @@ class ConversationModel
|
|||
@WorkerThread
|
||||
private fun updateLastUpdatedTime() {
|
||||
val timestamp = chatRoom.lastUpdateTime
|
||||
val humanReadableTimestamp = when {
|
||||
TimestampUtils.isToday(timestamp) -> {
|
||||
TimestampUtils.timeToString(chatRoom.lastUpdateTime)
|
||||
}
|
||||
TimestampUtils.isYesterday(timestamp) -> {
|
||||
AppUtils.getString(R.string.yesterday)
|
||||
}
|
||||
else -> {
|
||||
TimestampUtils.toString(chatRoom.lastUpdateTime, onlyDate = true)
|
||||
}
|
||||
}
|
||||
dateTime.postValue(humanReadableTimestamp)
|
||||
lastUpdateTime.postValue(timestamp)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue