Skip to content

CallViewmodel refactor#3560

Merged
toger5 merged 67 commits intolivekitfrom
voip-team/call-viewmodel-refactor
Nov 18, 2025
Merged

CallViewmodel refactor#3560
toger5 merged 67 commits intolivekitfrom
voip-team/call-viewmodel-refactor

Conversation

@toger5
Copy link
Copy Markdown
Contributor

@toger5 toger5 commented Nov 11, 2025

This is a large refactor for the call view model.

The main goals are

  • better testability
  • easier to read code
  • codebase suitable for growing number of developers
  • a clear paradigme how we seperate things in the CallViewModel (TODO provide schema and docs about the final decisions in the code and this PR-description)
  • Very good test coverage for the refactored parts.

toger5 and others added 30 commits October 28, 2025 21:18
Co-authored-by: Valere <[email protected]>
Co-authored-by: Valere <[email protected]>
- Extract a ConnectionFactory
- Change Connection manager allPariticipantWithConnection$ for structure that supports members with no participant
new classes. The CallViewModel is not done yet however
Remove preferStickyEvents and multiSfu in favor of a MatrixRTCMode
enum/setting (Legacy, Compatibil, Matrix_2_0). Move session join/leave,
track pause/resume, and config error handling out of CallViewModel into
the localMembership module. Update developer settings UI, i18n strings,
and related RTC session helpers and wiring accordingly.
- Replace MatrixLivekitItem with MatrixLivekitMember, add displayName$
  and participantId, and use explicit LiveKit participant types
- Make sessionBehaviors$ accept a props object and return a typed
  RxRtcSession
- Update CallViewModel to use the new session behaviors, rebuild media
  items from matrixLivekitMembers, handle missing connections and use
  participantId-based keys
- Change localMembership/localTransport to accept Behavior-based
  options, read options.value for enterRTCSession, and fix advertised
  transport selection order
- Update tests and minor UI adjustments (settings modal livekitRooms
  stubbed) and fix JSON formatting in locales
Rename several classes/behaviors to factory-style creators and adapt
call wiring and tests accordingly:
- Replace ConnectionManager class with createConnectionManager$ which
  returns transports$, connectionManagerData$, connections$
- Convert MatrixLivekitMerger to createMatrixLivekitMembers$
  (matrixLivekitMerger$)
- Rename sessionBehaviors$, localMembership$, localTransport$ to
  createSessionMembershipsAndTransports$, createLocalMembership$,
  createLocalTransport$
- Adjust participant types and hook up connectOptions$; expose join via
  localMembership.requestConnect
- Update tests to use the new factory APIs
 - NEVER use undefined as the default for behaviors (FOOTGUN)
This comma was showing up in the bottom left corner of the UI.
* move ononone layout into CallViewModel

* move even more into the vm.

* tests
* playwright: Fix error boundary mgmt or openId errors

* do not use tap for important logic

* fix lint

---------

Co-authored-by: Timo K <[email protected]>
minimal changes thanks to the intermediate class refactor)
@toger5 toger5 changed the title CallViewmodel refactor CallViewmodel refactor Nov 17, 2025
toger5 and others added 2 commits November 17, 2025 19:45
@@ -0,0 +1,628 @@
/*
Copyright 2025 New Vector Ltd.
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.

© 2025 Element Creations Ltd.

Copy link
Copy Markdown
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

We need to update the headers with © 2025 Element Creations Ltd.

@@ -0,0 +1,179 @@
/*
Copyright 2025 New Vector Ltd.
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.

© 2025 Element Creations Ltd.

@BillCarsonFr BillCarsonFr self-requested a review November 18, 2025 11:14
Copy link
Copy Markdown
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

looked at it in a peer review. It is ok to merge from me and start building on top of it

@toger5 toger5 merged commit 665a6be into livekit Nov 18, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Improvement Release note category. A PR that improves EC's performance or stability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants