Ensure that non-ringing notifications lead to a null pickup state
This commit is contained in:
@@ -158,7 +158,8 @@ export const ActiveCall: FC<ActiveCallProps> = (props) => {
|
|||||||
};
|
};
|
||||||
}, [livekitRoom]);
|
}, [livekitRoom]);
|
||||||
|
|
||||||
const { autoLeaveWhenOthersLeft } = useUrlParams();
|
const { autoLeaveWhenOthersLeft, sendNotificationType, waitForCallPickup } =
|
||||||
|
useUrlParams();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (livekitRoom !== undefined) {
|
if (livekitRoom !== undefined) {
|
||||||
@@ -171,6 +172,8 @@ export const ActiveCall: FC<ActiveCallProps> = (props) => {
|
|||||||
{
|
{
|
||||||
encryptionSystem: props.e2eeSystem,
|
encryptionSystem: props.e2eeSystem,
|
||||||
autoLeaveWhenOthersLeft,
|
autoLeaveWhenOthersLeft,
|
||||||
|
waitForCallPickup:
|
||||||
|
waitForCallPickup && sendNotificationType === "ring",
|
||||||
},
|
},
|
||||||
connStateObservable$,
|
connStateObservable$,
|
||||||
reactionsReader.raisedHands$,
|
reactionsReader.raisedHands$,
|
||||||
@@ -190,6 +193,8 @@ export const ActiveCall: FC<ActiveCallProps> = (props) => {
|
|||||||
props.e2eeSystem,
|
props.e2eeSystem,
|
||||||
connStateObservable$,
|
connStateObservable$,
|
||||||
autoLeaveWhenOthersLeft,
|
autoLeaveWhenOthersLeft,
|
||||||
|
sendNotificationType,
|
||||||
|
waitForCallPickup,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (livekitRoom === undefined || vm === null) return null;
|
if (livekitRoom === undefined || vm === null) return null;
|
||||||
|
|||||||
@@ -907,15 +907,17 @@ export class CallViewModel extends ViewModel {
|
|||||||
>
|
>
|
||||||
>
|
>
|
||||||
).pipe(
|
).pipe(
|
||||||
|
filter(
|
||||||
|
([notificationEvent]) => notificationEvent.notification_type === "ring",
|
||||||
|
),
|
||||||
map(([notificationEvent]) => {
|
map(([notificationEvent]) => {
|
||||||
// event.lifetime is expected to be in ms
|
const lifetimeMs = notificationEvent?.lifetime ?? 0;
|
||||||
const lifetime = notificationEvent?.lifetime ?? 0;
|
|
||||||
return concat(
|
return concat(
|
||||||
lifetime === 0
|
lifetimeMs === 0
|
||||||
? // If no lifetime, skip the ring state
|
? // If no lifetime, skip the ring state
|
||||||
EMPTY
|
EMPTY
|
||||||
: // Ring until lifetime ms have passed
|
: // Ring until lifetime ms have passed
|
||||||
timer(lifetime).pipe(
|
timer(lifetimeMs).pipe(
|
||||||
ignoreElements(),
|
ignoreElements(),
|
||||||
startWith("ringing" as const),
|
startWith("ringing" as const),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user