From 2541f810fa8a66c5e68393e380cd8398b1d72677 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 5 Sep 2025 14:36:27 +0200 Subject: [PATCH] Ensure that non-ringing notifications lead to a null pickup state --- src/room/InCallView.tsx | 7 ++++++- src/state/CallViewModel.ts | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 034be16d..e87072d3 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -158,7 +158,8 @@ export const ActiveCall: FC = (props) => { }; }, [livekitRoom]); - const { autoLeaveWhenOthersLeft } = useUrlParams(); + const { autoLeaveWhenOthersLeft, sendNotificationType, waitForCallPickup } = + useUrlParams(); useEffect(() => { if (livekitRoom !== undefined) { @@ -171,6 +172,8 @@ export const ActiveCall: FC = (props) => { { encryptionSystem: props.e2eeSystem, autoLeaveWhenOthersLeft, + waitForCallPickup: + waitForCallPickup && sendNotificationType === "ring", }, connStateObservable$, reactionsReader.raisedHands$, @@ -190,6 +193,8 @@ export const ActiveCall: FC = (props) => { props.e2eeSystem, connStateObservable$, autoLeaveWhenOthersLeft, + sendNotificationType, + waitForCallPickup, ]); if (livekitRoom === undefined || vm === null) return null; diff --git a/src/state/CallViewModel.ts b/src/state/CallViewModel.ts index 5b946f09..5dbb0b9c 100644 --- a/src/state/CallViewModel.ts +++ b/src/state/CallViewModel.ts @@ -907,15 +907,17 @@ export class CallViewModel extends ViewModel { > > ).pipe( + filter( + ([notificationEvent]) => notificationEvent.notification_type === "ring", + ), map(([notificationEvent]) => { - // event.lifetime is expected to be in ms - const lifetime = notificationEvent?.lifetime ?? 0; + const lifetimeMs = notificationEvent?.lifetime ?? 0; return concat( - lifetime === 0 + lifetimeMs === 0 ? // If no lifetime, skip the ring state EMPTY : // Ring until lifetime ms have passed - timer(lifetime).pipe( + timer(lifetimeMs).pipe( ignoreElements(), startWith("ringing" as const), ),