feat(call): Active call timeline rendering#7051
Open
BillCarsonFr wants to merge 18 commits into
Open
Conversation
Contributor
|
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
|
ganfra
reviewed
Jul 16, 2026
| ) | ||
| Text( | ||
| modifier = Modifier.padding(start = 6.dp), | ||
| text = "${caller.displayName ?: caller.userId} started a call", |
| ) { | ||
| if (!state.isJoined) { | ||
| Button( | ||
| text = "Join", |
| declinedBy = it.declinedBy.map(::UserId) | ||
| declinedBy = it.declinedBy.map(::UserId), | ||
| activeMembers = it.activeMembers.map(::UserId), | ||
| callStartTsMillis = it.callStartTsMillis?.toLong() ?: 0, |
Member
There was a problem hiding this comment.
Maybe we should keep the nullability here
Comment on lines
+114
to
+130
| state = if (itemContent.activeMembers.isNotEmpty()) { | ||
| RtcNotificationState.Active( | ||
| joinedMembers = itemContent.activeMembers.map { active -> | ||
| roomMembers.find { | ||
| it.userId == active | ||
| }?.toMatrixUser() ?: MatrixUser(active) | ||
| }, | ||
| isJoined = itemContent.isJoined, | ||
| callStartTsMillis = itemContent.callStartTsMillis, | ||
| callIntent = itemContent.callIntent | ||
| ) | ||
| } else { | ||
| RtcNotificationState.Declined(itemContent.declinedBy.any { it == sessionId }) | ||
| if (itemContent.declinedBy.isEmpty()) { | ||
| RtcNotificationState.Started | ||
| } else { | ||
| RtcNotificationState.Declined(itemContent.declinedBy.any { it == sessionId }) | ||
| } |
Comment on lines
+86
to
+96
| var currentTime by remember { mutableLongStateOf(System.currentTimeMillis()) } | ||
|
|
||
| LaunchedEffect(Unit) { | ||
| while (true) { | ||
| delay(1.seconds) | ||
| currentTime = System.currentTimeMillis() | ||
| } | ||
| } | ||
|
|
||
| val elapsedMillis = (currentTime - state.callStartTsMillis).coerceAtLeast(0) | ||
| val formattedDuration = elapsedMillis.toHumanReadableDuration() |
Member
There was a problem hiding this comment.
Extract this to his own component to avoid recomposition of the whole function every second. Also use produceState. Something like this :
@Composable
private fun CallDurationText(
startTsMillis: Long,
modifier: Modifier = Modifier,
) {
val duration by produceState(
initialValue = formatElapsed(startTsMillis),
startTsMillis,
) {
while (true) {
delay(1.seconds)
value = formatElapsed(startTsMillis)
}
}
Text(
modifier = modifier,
text = "($duration)",
style = ElementTheme.typography.fontBodyXsRegular,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
private fun formatElapsed(startTsMillis: Long): String =
(System.currentTimeMillis() - startTsMillis).coerceAtLeast(0).toHumanReadableDuration()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Content
Fixes #6749
Draft because depends of rust sdk changes matrix-org/matrix-rust-sdk#6668
Motivation and context
Render the members currently in the active call in the timeline
Screenshots / GIFs
Tests
Tested devices
Checklist