CallTileTimelineItem.CallStatus.MISSED renders both missed and rejected calls. Logic should be !answered.

This commit is contained in:
David Langley 2022-01-28 08:57:19 +00:00
parent ff6810f1f4
commit e9ae76da9c
3 changed files with 4 additions and 6 deletions

1
changelog.d/5088.bugfix Normal file
View file

@ -0,0 +1 @@
Fixes call statuses in the timeline for missed/rejected calls and connected calls.

View file

@ -101,7 +101,7 @@ 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.MISSED else CallTileTimelineItem.CallStatus.ENDED,
callKind = callKind,
callback = params.callback,
highlight = params.isHighlighted,

View file

@ -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? {