mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Sort delivery status lists by timestamp
This commit is contained in:
parent
12e7041c57
commit
896b621545
3 changed files with 20 additions and 5 deletions
|
|
@ -27,6 +27,7 @@ import org.linphone.core.Address
|
|||
class MessageBottomSheetParticipantModel @WorkerThread constructor(
|
||||
address: Address,
|
||||
val value: String,
|
||||
val timestamp: Long,
|
||||
val isOurOwnReaction: Boolean = false,
|
||||
val onClick: (() -> Unit)? = null
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -101,10 +101,12 @@ class MessageDeliveryModel @WorkerThread constructor(
|
|||
errorModels.clear()
|
||||
|
||||
for (participant in chatMessage.getParticipantsByImdnState(State.Displayed)) {
|
||||
val timestamp = participant.stateChangeTime
|
||||
displayedModels.add(
|
||||
MessageBottomSheetParticipantModel(
|
||||
participant.participant.address,
|
||||
TimestampUtils.toString(participant.stateChangeTime)
|
||||
TimestampUtils.toString(timestamp),
|
||||
timestamp
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -117,10 +119,12 @@ class MessageDeliveryModel @WorkerThread constructor(
|
|||
)
|
||||
|
||||
for (participant in chatMessage.getParticipantsByImdnState(State.DeliveredToUser)) {
|
||||
val timestamp = participant.stateChangeTime
|
||||
deliveredModels.add(
|
||||
MessageBottomSheetParticipantModel(
|
||||
participant.participant.address,
|
||||
TimestampUtils.toString(participant.stateChangeTime)
|
||||
TimestampUtils.toString(timestamp),
|
||||
timestamp
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -133,10 +137,12 @@ class MessageDeliveryModel @WorkerThread constructor(
|
|||
)
|
||||
|
||||
for (participant in chatMessage.getParticipantsByImdnState(State.Delivered)) {
|
||||
val timestamp = participant.stateChangeTime
|
||||
sentModels.add(
|
||||
MessageBottomSheetParticipantModel(
|
||||
participant.participant.address,
|
||||
TimestampUtils.toString(participant.stateChangeTime)
|
||||
TimestampUtils.toString(timestamp),
|
||||
timestamp
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -149,10 +155,12 @@ class MessageDeliveryModel @WorkerThread constructor(
|
|||
)
|
||||
|
||||
for (participant in chatMessage.getParticipantsByImdnState(State.NotDelivered)) {
|
||||
val timestamp = participant.stateChangeTime
|
||||
errorModels.add(
|
||||
MessageBottomSheetParticipantModel(
|
||||
participant.participant.address,
|
||||
TimestampUtils.toString(participant.stateChangeTime)
|
||||
TimestampUtils.toString(timestamp),
|
||||
timestamp
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -164,6 +172,11 @@ class MessageDeliveryModel @WorkerThread constructor(
|
|||
)
|
||||
)
|
||||
|
||||
displayedModels.sortBy { it.timestamp }
|
||||
deliveredModels.sortBy { it.timestamp }
|
||||
sentModels.sortBy { it.timestamp }
|
||||
errorModels.sortBy { it.timestamp }
|
||||
|
||||
Log.i("$TAG Message ID [${chatMessage.messageId}] is in state [${chatMessage.state}]")
|
||||
Log.i(
|
||||
"$TAG There are [$readCount] that have read this message, [$receivedCount] that have received it, [$sentCount] that haven't received it yet and [$errorCount] that probably won't receive it due to an error"
|
||||
|
|
|
|||
|
|
@ -93,7 +93,8 @@ class MessageReactionsModel @WorkerThread constructor(
|
|||
allReactions.add(
|
||||
MessageBottomSheetParticipantModel(
|
||||
reaction.fromAddress,
|
||||
body,
|
||||
reaction.body,
|
||||
-1,
|
||||
isOurOwn
|
||||
) {
|
||||
if (isOurOwn) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue