mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-07 21:45:18 +00:00
Cleanup boolean logic
This commit is contained in:
@@ -276,18 +276,15 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (skipLobby) {
|
if (skipLobby) {
|
||||||
if (widget) {
|
if (widget && preload) {
|
||||||
if (preload) {
|
|
||||||
// In preload mode without lobby we wait for a join action before entering
|
// In preload mode without lobby we wait for a join action before entering
|
||||||
const onJoin = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
const onJoin = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
||||||
(async (): Promise<void> => {
|
(async (): Promise<void> => {
|
||||||
await defaultDeviceSetup(
|
await defaultDeviceSetup(ev.detail.data as unknown as JoinCallData);
|
||||||
ev.detail.data as unknown as JoinCallData,
|
|
||||||
);
|
|
||||||
await enterRTCSessionOrError(rtcSession);
|
await enterRTCSessionOrError(rtcSession);
|
||||||
widget.api.transport.reply(ev.detail, {});
|
widget.api.transport.reply(ev.detail, {});
|
||||||
})().catch((e) => {
|
})().catch((e) => {
|
||||||
logger.error("Error joining RTC session", e);
|
logger.error("Error joining RTC session on preload", e);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
widget.lazyActions.on(ElementWidgetActions.JoinCall, onJoin);
|
widget.lazyActions.on(ElementWidgetActions.JoinCall, onJoin);
|
||||||
@@ -299,12 +296,9 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
(async (): Promise<void> => {
|
(async (): Promise<void> => {
|
||||||
await enterRTCSessionOrError(rtcSession);
|
await enterRTCSessionOrError(rtcSession);
|
||||||
})().catch((e) => {
|
})().catch((e) => {
|
||||||
logger.error("Error joining RTC session", e);
|
logger.error("Error joining RTC session immediately", e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
void enterRTCSessionOrError(rtcSession);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
widget,
|
widget,
|
||||||
@@ -494,6 +488,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
// Left in widget mode:
|
// Left in widget mode:
|
||||||
body = returnToLobby ? lobbyView : null;
|
body = returnToLobby ? lobbyView : null;
|
||||||
} else if (preload || skipLobby) {
|
} else if (preload || skipLobby) {
|
||||||
|
// The RTC session is not joined to yet (`isJoined`), but enterRTCSessionOrError should have been called.
|
||||||
body = null;
|
body = null;
|
||||||
} else {
|
} else {
|
||||||
body = lobbyView;
|
body = lobbyView;
|
||||||
|
|||||||
Reference in New Issue
Block a user