mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-06 15:30:27 +03:00
update references to transport to clientwidgetapi (as transport is a child object of)
This commit is contained in:
parent
b5ca54d6fd
commit
1e8a69ff23
1 changed files with 9 additions and 6 deletions
|
|
@ -28,7 +28,7 @@ interface PersistentCallContainerProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PersistentCallContainer({ isVisible }: PersistentCallContainerProps) {
|
export function PersistentCallContainer({ isVisible }: PersistentCallContainerProps) {
|
||||||
const { activeCallRoomId, isChatOpen, setActiveCallRoomId, registerActiveTransport } =
|
const { activeCallRoomId, isChatOpen, setActiveCallRoomId, registerActiveClientWidgetApi } =
|
||||||
useCallState();
|
useCallState();
|
||||||
const { eventId } = useParams();
|
const { eventId } = useParams();
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
|
|
@ -57,7 +57,7 @@ export function PersistentCallContainer({ isVisible }: PersistentCallContainerPr
|
||||||
* Might also be able to keep the iframe alive and instead navigate to a new "room" to make the transition smoother
|
* Might also be able to keep the iframe alive and instead navigate to a new "room" to make the transition smoother
|
||||||
*/
|
*/
|
||||||
const cleanup = () => {
|
const cleanup = () => {
|
||||||
logger.error(`PersistentCallContainer: Cleaning up for previous room: ${cleanupRoomId}`);
|
logger.error(`CallContext: Cleaning up for previous room: ${cleanupRoomId}`);
|
||||||
|
|
||||||
if (smallWidgetRef.current) {
|
if (smallWidgetRef.current) {
|
||||||
// smallWidgetRef.current.stopMessaging();
|
// smallWidgetRef.current.stopMessaging();
|
||||||
|
|
@ -68,12 +68,17 @@ export function PersistentCallContainer({ isVisible }: PersistentCallContainerPr
|
||||||
}
|
}
|
||||||
widgetApiRef.current = null;
|
widgetApiRef.current = null;
|
||||||
smallWidgetRef.current = null;
|
smallWidgetRef.current = null;
|
||||||
|
//hangUp();
|
||||||
if (iframeRef.current) iframeRef.current.src = 'about:blank';
|
if (iframeRef.current) iframeRef.current.src = 'about:blank';
|
||||||
};
|
};
|
||||||
|
|
||||||
if (activeCallRoomId && mx?.getUserId()) {
|
if (activeCallRoomId && mx?.getUserId()) {
|
||||||
if (cleanupRoomId !== activeCallRoomId) {
|
if (cleanupRoomId !== activeCallRoomId) {
|
||||||
const newUrl = getWidgetUrl(mx, roomId, clientConfig.elementCallUrl ?? '');
|
const newUrl = getWidgetUrl(mx, roomId, clientConfig.elementCallUrl ?? '', {
|
||||||
|
skipLobby: 'true',
|
||||||
|
returnToLobby: 'true',
|
||||||
|
perParticipentE2EE: 'true',
|
||||||
|
});
|
||||||
|
|
||||||
if (iframeRef.current && iframeRef.current.src !== newUrl.toString()) {
|
if (iframeRef.current && iframeRef.current.src !== newUrl.toString()) {
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
@ -116,7 +121,7 @@ export function PersistentCallContainer({ isVisible }: PersistentCallContainerPr
|
||||||
try {
|
try {
|
||||||
const widgetApiInstance = smallWidget.startMessaging(iframeElement);
|
const widgetApiInstance = smallWidget.startMessaging(iframeElement);
|
||||||
widgetApiRef.current = widgetApiInstance;
|
widgetApiRef.current = widgetApiInstance;
|
||||||
registerActiveTransport(activeCallRoomId, widgetApiRef.current.transport);
|
registerActiveClientWidgetApi(activeCallRoomId, widgetApiRef.current);
|
||||||
widgetApiInstance.once('ready', () => {
|
widgetApiInstance.once('ready', () => {
|
||||||
logger.info(`PersistentCallContainer: Widget for ${activeCallRoomId} is ready.`);
|
logger.info(`PersistentCallContainer: Widget for ${activeCallRoomId} is ready.`);
|
||||||
});
|
});
|
||||||
|
|
@ -135,7 +140,6 @@ export function PersistentCallContainer({ isVisible }: PersistentCallContainerPr
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cleanup;
|
return cleanup;
|
||||||
}, [activeCallRoomId, mx, setActiveCallRoomId]);
|
}, [activeCallRoomId, mx, setActiveCallRoomId]);
|
||||||
|
|
||||||
|
|
@ -212,7 +216,6 @@ export function PersistentCallContainer({ isVisible }: PersistentCallContainerPr
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Box grow="Yes" direction="Column" style={{ position: 'relative' }}>
|
<Box grow="Yes" direction="Column" style={{ position: 'relative' }}>
|
||||||
{/* Mobile should remove the iframe visibility when chat is toggled */}
|
|
||||||
{isChatOpen && activeCallRoomId && roomId && room !== null && (
|
{isChatOpen && activeCallRoomId && roomId && room !== null && (
|
||||||
<PowerLevelsContainer>
|
<PowerLevelsContainer>
|
||||||
<RoomView room={room} eventId={eventId} />
|
<RoomView room={room} eventId={eventId} />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue