From f518111887048e382cdf92fdaf95d8cd6434b692 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 17 Nov 2025 14:55:00 +0100 Subject: [PATCH] add back docstrings --- src/reactions/ReactionsReader.ts | 1 + src/state/CallViewModel/CallViewModel.ts | 78 ++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/src/reactions/ReactionsReader.ts b/src/reactions/ReactionsReader.ts index c1f78b51..74b47c77 100644 --- a/src/reactions/ReactionsReader.ts +++ b/src/reactions/ReactionsReader.ts @@ -266,6 +266,7 @@ export class ReactionsReader { ); return; } + // TODO refactor to use memer id `membershipEvent.membershipID` (needs to happen in combination with other memberId refactors) const identifier = `${membershipEvent.userId}:${membershipEvent.deviceId}`; if (!content.emoji) { diff --git a/src/state/CallViewModel/CallViewModel.ts b/src/state/CallViewModel/CallViewModel.ts index 3e3d8190..063a953e 100644 --- a/src/state/CallViewModel/CallViewModel.ts +++ b/src/state/CallViewModel/CallViewModel.ts @@ -181,32 +181,68 @@ type AudioLivekitItem = { export class CallViewModel { // lifecycle public autoLeave$: Observable; + // TODO if we are in "unknown" state we need a loading rendering (or empty screen) + // Otherwise it looks like we already connected and only than the ringing starts which is weird. public callPickupState$: Behavior< "unknown" | "ringing" | "timeout" | "decline" | "success" | null >; public leave$: Observable<"user" | AutoLeaveReason>; + /** Call to initiate hangup. Use in conbination with connectino state track the async hangup process. */ public hangup: () => void; // joining public join: () => LocalMemberConnectionState; // screen sharing + /** + * Callback to toggle screen sharing. If null, screen sharing is not possible. + */ public toggleScreenSharing: (() => void) | null; + /** + * Whether we are sharing our screen. + */ public sharingScreen$: Behavior; // UI interactions + /** + * Callback for when the user taps the call view. + */ public tapScreen: () => void; + /** + * Callback for when the user taps the call's controls. + */ public tapControls: () => void; + /** + * Callback for when the user hovers over the call view. + */ public hoverScreen: () => void; + /** + * Callback for when the user stops hovering over the call view. + */ public unhoverScreen: () => void; // errors + /** + * If there is a configuration error with the call (e.g. misconfigured E2EE). + * This is a fatal error that prevents the call from being created/joined. + * Should render a blocking error screen. + */ public configError$: Behavior; // participants and counts + /** + * The number of participants currently in the call. + * + * - Each participant has a corresponding MatrixRTC membership state event + * - There can be multiple participants for one Matrix user if they join from + * multiple devices. + */ public participantCount$: Behavior; + /** Participants sorted by livekit room so they can be used in the audio rendering */ public audioParticipants$: Behavior; + /** List of participants raising their hand */ public handsRaised$: Behavior>; + /** List of reactions. Keys are: membership.membershipId (currently predefined as: `${membershipEvent.userId}:${membershipEvent.deviceId}`)*/ public reactions$: Behavior>; public isOneOnOneWith$: Behavior; public leaveSoundEffect$: Observable; + /** + * Emits an event every time a new hand is raised in + * the call. + */ public newHandRaised$: Observable<{ value: number; playSounds: boolean }>; + /** + * Emits an event every time a new screenshare is started in + * the call. + */ public newScreenShare$: Observable<{ value: number; playSounds: boolean }>; + /** + * Emits an array of reactions that should be played. + */ public audibleReactions$: Observable; + /** + * Emits an array of reactions that should be visible on the screen. + */ + // DISCUSSION move this into a reaction file public visibleReactions$: Behavior< { sender: string; emoji: string; startX: number }[] >; // window/layout + /** + * The general shape of the window. + */ public windowMode$: Behavior; public spotlightExpanded$: Behavior; public toggleSpotlightExpanded$: Behavior<(() => void) | null>; @@ -234,7 +288,13 @@ export class CallViewModel { public grid$: Behavior; public spotlight$: Behavior; public pip$: Behavior; + /** + * The layout of tiles in the call interface. + */ public layout$: Behavior; + /** + * The current generation of the tile store, exposed for debugging purposes. + */ public tileStoreGeneration$: Behavior; public showSpotlightIndicators$: Behavior; public showSpeakingIndicators$: Behavior; @@ -244,13 +304,31 @@ export class CallViewModel { public showFooter$: Behavior; // audio routing + /** + * Whether audio is currently being output through the earpiece. + */ public earpieceMode$: Behavior; + /** + * Callback to toggle between the earpiece and the loudspeaker. + * + * This will be `null` in case the target does not exist in the list + * of available audio outputs. + */ public audioOutputSwitcher$: Behavior<{ targetOutput: "earpiece" | "speaker"; switch: () => void; } | null>; // connection state + /** + * Whether various media/event sources should pretend to be disconnected from + * all network input, even if their connection still technically works. + */ + // We do this when the app is in the 'reconnecting' state, because it might be + // that the LiveKit connection is still functional while the homeserver is + // down, for example, and we want to avoid making people worry that the app is + // in a split-brained state. + // DISCUSSION own membership manager ALSO this probably can be simplifis public reconnecting$: Behavior; // THIS has to be the last public field declaration