mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-11 01:30:29 +03:00
Activate when active call state is false
This commit is contained in:
parent
ec741423c7
commit
a5551909c1
1 changed files with 3 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||||
|
|
||||||
export function CallActivationEffect() {
|
export function CallActivationEffect() {
|
||||||
const { roomIdOrAlias: viewedRoomId } = useParams<{ roomIdOrAlias: string }>();
|
const { roomIdOrAlias: viewedRoomId } = useParams<{ roomIdOrAlias: string }>();
|
||||||
const { activeCallRoomId, setActiveCallRoomId } = useCallState();
|
const { activeCallRoomId, isCallActive, setActiveCallRoomId } = useCallState();
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
const room = mx.getRoom(viewedRoomId);
|
const room = mx.getRoom(viewedRoomId);
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ export function CallActivationEffect() {
|
||||||
const isViewingCallRoom = room?.isCallRoom?.() ?? false;
|
const isViewingCallRoom = room?.isCallRoom?.() ?? false;
|
||||||
|
|
||||||
if (isViewingCallRoom) {
|
if (isViewingCallRoom) {
|
||||||
if (viewedRoomId !== activeCallRoomId) {
|
if (viewedRoomId !== activeCallRoomId && !isCallActive) {
|
||||||
logger.info(`CallActivationEffect: Auto-activating call for viewed room: ${viewedRoomId}`);
|
logger.info(`CallActivationEffect: Auto-activating call for viewed room: ${viewedRoomId}`);
|
||||||
setActiveCallRoomId(viewedRoomId);
|
setActiveCallRoomId(viewedRoomId);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -29,7 +29,7 @@ export function CallActivationEffect() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [viewedRoomId, activeCallRoomId, setActiveCallRoomId, mx, room]);
|
}, [viewedRoomId, activeCallRoomId, setActiveCallRoomId, isCallActive, mx, room]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue