diff --git a/changelog.d/5088.bugfix b/changelog.d/5088.bugfix new file mode 100644 index 00000000000..bc702e5e94a --- /dev/null +++ b/changelog.d/5088.bugfix @@ -0,0 +1 @@ +Fixes call statuses in the timeline for missed/rejected calls and connected calls. \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt index 97f2618fe66..0161f0b55d5 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt @@ -101,7 +101,11 @@ class CallItemFactory @Inject constructor( createCallTileTimelineItem( roomSummary = roomSummary, callId = callEventGrouper.callId, - callStatus = if (callEventGrouper.callWasMissed()) CallTileTimelineItem.CallStatus.MISSED else CallTileTimelineItem.CallStatus.ENDED, + callStatus = if (callEventGrouper.callWasAnswered()) { + CallTileTimelineItem.CallStatus.ENDED + } else { + CallTileTimelineItem.CallStatus.MISSED + }, callKind = callKind, callback = params.callback, highlight = params.isHighlighted, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventsGroups.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventsGroups.kt index 39102042931..4ff8a9fa439 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventsGroups.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventsGroups.kt @@ -108,11 +108,8 @@ class CallSignalingEventsGroup(private val group: TimelineEventsGroup) { } } - /** - * Returns true if there are only events from one side. - */ - fun callWasMissed(): Boolean { - return group.events.distinctBy { it.senderInfo.userId }.size == 1 + fun callWasAnswered(): Boolean { + return getAnswer() != null } private fun getAnswer(): TimelineEvent? {