mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-19 06:20:25 +00:00
@@ -87,7 +87,8 @@ interface Props {
|
||||
skipLobby: boolean;
|
||||
header: HeaderStyle;
|
||||
rtcSession: MatrixRTCSession;
|
||||
isJoined: boolean;
|
||||
joined: boolean;
|
||||
setJoined: (value: boolean) => void;
|
||||
muteStates: MuteStates;
|
||||
widget: WidgetHelpers | null;
|
||||
}
|
||||
@@ -100,7 +101,8 @@ export const GroupCallView: FC<Props> = ({
|
||||
skipLobby,
|
||||
header,
|
||||
rtcSession,
|
||||
isJoined,
|
||||
joined,
|
||||
setJoined,
|
||||
muteStates,
|
||||
widget,
|
||||
}) => {
|
||||
@@ -210,12 +212,14 @@ export const GroupCallView: FC<Props> = ({
|
||||
const enterRTCSessionOrError = useCallback(
|
||||
async (rtcSession: MatrixRTCSession): Promise<void> => {
|
||||
try {
|
||||
await enterRTCSession(
|
||||
rtcSession,
|
||||
perParticipantE2EE,
|
||||
useNewMembershipManager,
|
||||
useExperimentalToDeviceTransport,
|
||||
);
|
||||
setJoined(true);
|
||||
// TODO-MULTI-SFU what to do with error handling now that we don't use this function?
|
||||
// await enterRTCSession(
|
||||
// rtcSession,
|
||||
// perParticipantE2EE,
|
||||
// useNewMembershipManager,
|
||||
// useExperimentalToDeviceTransport,
|
||||
// );
|
||||
} catch (e) {
|
||||
if (e instanceof ElementCallError) {
|
||||
setExternalError(e);
|
||||
@@ -227,12 +231,9 @@ export const GroupCallView: FC<Props> = ({
|
||||
setExternalError(error);
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
[
|
||||
perParticipantE2EE,
|
||||
useExperimentalToDeviceTransport,
|
||||
useNewMembershipManager,
|
||||
],
|
||||
[],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -284,7 +285,7 @@ export const GroupCallView: FC<Props> = ({
|
||||
await defaultDeviceSetup(
|
||||
ev.detail.data as unknown as JoinCallData,
|
||||
);
|
||||
await enterRTCSessionOrError(rtcSession);
|
||||
setJoined(true);
|
||||
widget.api.transport.reply(ev.detail, {});
|
||||
})().catch((e) => {
|
||||
logger.error("Error joining RTC session", e);
|
||||
@@ -297,13 +298,13 @@ export const GroupCallView: FC<Props> = ({
|
||||
} else {
|
||||
// No lobby and no preload: we enter the rtc session right away
|
||||
(async (): Promise<void> => {
|
||||
await enterRTCSessionOrError(rtcSession);
|
||||
setJoined(true);
|
||||
})().catch((e) => {
|
||||
logger.error("Error joining RTC session", e);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
void enterRTCSessionOrError(rtcSession);
|
||||
setJoined(true);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
@@ -314,7 +315,7 @@ export const GroupCallView: FC<Props> = ({
|
||||
perParticipantE2EE,
|
||||
mediaDevices,
|
||||
latestMuteStates,
|
||||
enterRTCSessionOrError,
|
||||
setJoined,
|
||||
useNewMembershipManager,
|
||||
]);
|
||||
|
||||
@@ -373,7 +374,7 @@ export const GroupCallView: FC<Props> = ({
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (widget && isJoined) {
|
||||
if (widget && joined) {
|
||||
// set widget to sticky once joined.
|
||||
widget.api.setAlwaysOnScreen(true).catch((e) => {
|
||||
logger.error("Error calling setAlwaysOnScreen(true)", e);
|
||||
@@ -391,7 +392,7 @@ export const GroupCallView: FC<Props> = ({
|
||||
widget.lazyActions.off(ElementWidgetActions.HangupCall, onHangup);
|
||||
};
|
||||
}
|
||||
}, [widget, isJoined, rtcSession]);
|
||||
}, [widget, joined, rtcSession]);
|
||||
|
||||
const joinRule = useJoinRule(room);
|
||||
|
||||
@@ -426,7 +427,7 @@ export const GroupCallView: FC<Props> = ({
|
||||
client={client}
|
||||
matrixInfo={matrixInfo}
|
||||
muteStates={muteStates}
|
||||
onEnter={() => void enterRTCSessionOrError(rtcSession)}
|
||||
onEnter={() => setJoined(true)}
|
||||
confineToRoom={confineToRoom}
|
||||
hideHeader={header === HeaderStyle.None}
|
||||
participantCount={participantCount}
|
||||
@@ -444,7 +445,7 @@ export const GroupCallView: FC<Props> = ({
|
||||
throw externalError;
|
||||
};
|
||||
body = <ErrorComponent />;
|
||||
} else if (isJoined) {
|
||||
} else if (joined) {
|
||||
body = (
|
||||
<>
|
||||
{shareModal}
|
||||
|
||||
@@ -61,10 +61,8 @@ export const RoomPage: FC = () => {
|
||||
const { avatarUrl, displayName: userDisplayName } = useProfile(client);
|
||||
|
||||
const groupCallState = useLoadGroupCall(client, roomIdOrAlias, viaServers);
|
||||
const isJoined = useMatrixRTCSessionJoinState(
|
||||
groupCallState.kind === "loaded" ? groupCallState.rtcSession : undefined,
|
||||
);
|
||||
const muteStates = useMuteStates(isJoined);
|
||||
const [joined, setJoined] = useState(false);
|
||||
const muteStates = useMuteStates(joined);
|
||||
|
||||
useEffect(() => {
|
||||
// If we've finished loading, are not already authed and we've been given a display name as
|
||||
@@ -109,7 +107,8 @@ export const RoomPage: FC = () => {
|
||||
widget={widget}
|
||||
client={client!}
|
||||
rtcSession={groupCallState.rtcSession}
|
||||
isJoined={isJoined}
|
||||
joined={joined}
|
||||
setJoined={setJoined}
|
||||
isPasswordlessUser={passwordlessUser}
|
||||
confineToRoom={confineToRoom}
|
||||
preload={preload}
|
||||
|
||||
Reference in New Issue
Block a user