Skip to content

feat(call): Active call timeline rendering#7051

Open
BillCarsonFr wants to merge 18 commits into
developfrom
feature/valere/timeline_active_call_rendering
Open

feat(call): Active call timeline rendering#7051
BillCarsonFr wants to merge 18 commits into
developfrom
feature/valere/timeline_active_call_rendering

Conversation

@BillCarsonFr

@BillCarsonFr BillCarsonFr commented Jun 18, 2026

Copy link
Copy Markdown
Member

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

image

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • I am aware of the etiquette.
  • This PR was made with the help of AI:
    • Yes. In this case, please request a review by Copilot.
    • No.
  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly defines what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

@BillCarsonFr BillCarsonFr added the PR-Feature For a new feature label Jun 18, 2026
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/DYEiA9

@BillCarsonFr BillCarsonFr marked this pull request as ready for review July 13, 2026 13:59
@BillCarsonFr BillCarsonFr requested a review from a team as a code owner July 13, 2026 13:59
@BillCarsonFr BillCarsonFr requested review from ganfra and removed request for a team July 13, 2026 13:59
@BillCarsonFr BillCarsonFr added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Jul 15, 2026
@github-actions github-actions Bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Jul 15, 2026
@BillCarsonFr BillCarsonFr added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Jul 16, 2026
@github-actions github-actions Bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Jul 16, 2026
@sonarqubecloud

Copy link
Copy Markdown

@ganfra ganfra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some remarks, otherwise LGTM!

)
Text(
modifier = Modifier.padding(start = 6.dp),
text = "${caller.displayName ?: caller.userId} started a call",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localazy

) {
if (!state.isJoined) {
Button(
text = "Join",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localazy

declinedBy = it.declinedBy.map(::UserId)
declinedBy = it.declinedBy.map(::UserId),
activeMembers = it.activeMembers.map(::UserId),
callStartTsMillis = it.callStartTsMillis?.toLong() ?: 0,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 })
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use when please!

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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Feature For a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ElementCall: [Call Timeline] Active call timeline rendering

3 participants