Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Refactor element call lobby + skip lobby #12057

Merged
merged 58 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9bca273
Refactor ElementCall to use the widget lobby.
toger5 Dec 14, 2023
6d5ac0b
Use shiftKey click to skip the lobby
toger5 Dec 14, 2023
8ed0454
remove Lobby component
toger5 Dec 14, 2023
2518d56
update tests + remove EW lobby related tests
toger5 Dec 15, 2023
01d63df
remove lobby device button tests
toger5 Dec 15, 2023
b12d176
i18n
toger5 Dec 15, 2023
448403c
use voip participant label
toger5 Dec 15, 2023
ce76630
update tests
toger5 Dec 15, 2023
2907373
Merge branch 'develop' into toger5/skip_lobby
toger5 Dec 20, 2023
f01b155
fix rounded corners in pip
toger5 Dec 27, 2023
68808fb
allow joining call in legacy room header (without banner)
toger5 Dec 27, 2023
821211a
Introduce new connection states for calls.
toger5 Dec 27, 2023
d1e3a6d
New room header call join
toger5 Dec 27, 2023
1a2a2c9
i18n
toger5 Dec 27, 2023
24d39b8
Fix closing element call in lobby view.
toger5 Dec 27, 2023
4d99794
Merge branch 'develop' into toger5/skip_lobby
toger5 Dec 27, 2023
54f39a9
all cases for connection state
toger5 Dec 27, 2023
628ea01
add correct LiveContentSummary labels
toger5 Dec 27, 2023
8ccb991
Theme widget loading (no rounded corner)
toger5 Dec 28, 2023
3fed014
temp
toger5 Jan 15, 2024
7e83add
Merge branch 'develop' into toger5/skip_lobby
toger5 Jan 15, 2024
a2fcfc0
usei view room dispatcher instead of emitter
toger5 Jan 15, 2024
521ac24
tidy up
toger5 Jan 15, 2024
d658c56
returnToLobby + remove StartCallView
toger5 Jan 16, 2024
9c117cf
comment cleanup
toger5 Jan 16, 2024
29a69ed
disconnect ongoing calls before making widget sticky.
toger5 Jan 16, 2024
8548714
linter + jitsi as videoChannel
toger5 Jan 16, 2024
c91221f
stickyPromise type
toger5 Jan 16, 2024
5160df5
fix legacy call (jistsi, cisco, bbb) reopen
toger5 Jan 17, 2024
9f68561
fix tests and connect resolves
toger5 Jan 17, 2024
fcbd482
Merge branch 'develop' into toger5/skip_lobby
toger5 Jan 17, 2024
baf7669
fix "waits for messaging when connecting" test
toger5 Jan 17, 2024
201e155
Allow to skip awaiting Call session events.
toger5 Jan 17, 2024
0532c42
add sticky test
toger5 Jan 18, 2024
90a12d8
add test for looby tile rendering
toger5 Jan 19, 2024
dab8e1f
fix flaky test
toger5 Jan 19, 2024
9bb4989
add reconnect after disconnect test (video room)
toger5 Jan 19, 2024
64bc219
add shift click test to call toast
toger5 Jan 22, 2024
e20ea5e
test for allowVoipWithNoMedia in widget url
toger5 Jan 22, 2024
8b2df91
fix e2e tests to search for the right element
toger5 Jan 22, 2024
1c6a11b
destroy call after test so next test does not fail
toger5 Jan 22, 2024
b298271
new call test (connection failed)
toger5 Jan 22, 2024
820e330
reset to real timers
toger5 Jan 23, 2024
b4d3da7
Merge branch 'develop' into toger5/skip_lobby
toger5 Jan 23, 2024
59ddba7
dont use skipSessionAwait for tests
toger5 Jan 23, 2024
967930a
code quality (sonar)
toger5 Jan 23, 2024
33cf605
refactor call.disconnect tests (dont use skipSessionAwait)
toger5 Jan 23, 2024
843079f
miscellaneous cleanup
toger5 Jan 23, 2024
b9bf61a
only send call notify after the call has been joined (not when just o…
toger5 Jan 23, 2024
368b3ed
update call notify tests to expect notify on connect.
toger5 Jan 24, 2024
83e0374
Update playwright/e2e/room/room-header.spec.ts
toger5 Jan 25, 2024
9d61bc4
Update src/components/views/voip/CallView.tsx
toger5 Jan 25, 2024
09344a5
review
toger5 Jan 25, 2024
7673e5f
check for EC widget
toger5 Jan 25, 2024
f97fb9b
dep array
toger5 Jan 25, 2024
f25c2ea
rename in spyOn
toger5 Jan 25, 2024
91f8075
Merge branch 'develop' into toger5/skip_lobby
toger5 Jan 29, 2024
e34790d
Merge branch 'develop' into toger5/skip_lobby
toger5 Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions playwright/e2e/room/room-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ test.describe("Room Header", () => {

await page.locator(".mx_LegacyRoomHeader").getByRole("button", { name: "Chat" }).click();

// Assert that the video is rendered
await expect(page.locator(".mx_CallView video")).toBeVisible();
// Assert that the call view is still visible
await expect(page.locator(".mx_CallView")).toBeVisible();

// Assert that GELS is visible
await expect(
Expand Down
1 change: 1 addition & 0 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2564,6 +2564,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
room={this.state.room}
resizing={this.state.resizing}
waitForCall={isVideoRoom(this.state.room)}
skipLobby={this.context.roomViewStore.skipCallLobby() ?? false}
role="main"
/>
{previewBar}
Expand Down
1 change: 1 addition & 0 deletions src/components/views/beacon/RoomCallBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const RoomCallBannerInner: React.FC<RoomCallBannerProps> = ({ roomId, call }) =>
action: Action.ViewRoom,
room_id: roomId,
view_call: true,
skipLobby: "shiftKey" in ev ? ev.shiftKey : false,
metricsTrigger: undefined,
});
},
Expand Down
7 changes: 6 additions & 1 deletion src/components/views/elements/AppTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ interface IProps {
movePersistedElement?: MutableRefObject<(() => void) | undefined>;
// An element to render after the iframe as an overlay
overlay?: ReactNode;
// If defined this async method will be called when the widget requests to become sticky.
// It will only become sticky once the returned promise resolves.
// This is useful because: Widget B is sticky. Making widget A sticky will kill widget B immediately.
// This promise allows to do Widget B related cleanup before Widget A becomes sticky. (e.g. hangup a Voip call)
stickyPromise?: () => Promise<void>;
}

interface IState {
Expand Down Expand Up @@ -610,11 +615,11 @@ export default class AppTile extends React.Component<IProps, IState> {
"microphone; camera; encrypted-media; autoplay; display-capture; clipboard-write; " + "clipboard-read;";

const appTileBodyClass = classNames({
// We don't want mx_AppTileBody (rounded corners) for call widgets
"mx_AppTileBody": true,
"mx_AppTileBody--large": !this.props.miniMode,
"mx_AppTileBody--mini": this.props.miniMode,
"mx_AppTileBody--loading": this.state.loading,
// We don't want mx_AppTileBody (rounded corners) for call widgets
"mx_AppTileBody--call": this.props.app.type === WidgetType.CALL.preferred,
});
const appTileBodyStyles: CSSProperties = {};
Expand Down
6 changes: 4 additions & 2 deletions src/components/views/messages/CallEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ const ActiveLoadedCallEvent = forwardRef<any, ActiveLoadedCallEventProps>(({ mxE
switch (connectionState) {
case ConnectionState.Disconnected:
return [_t("action|join"), "primary", connect];
case ConnectionState.Connecting:
return [_t("action|join"), "primary", null];
case ConnectionState.Connected:
return [_t("action|leave"), "danger", disconnect];
case ConnectionState.Disconnecting:
return [_t("action|leave"), "danger", null];
case ConnectionState.Connecting:
case ConnectionState.Lobby:
case ConnectionState.WidgetLoading:
return [_t("action|join"), "primary", null];
}
}, [connectionState, connect, disconnect]);

Expand Down
30 changes: 17 additions & 13 deletions src/components/views/rooms/LegacyRoomHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,20 @@ const VideoCallButton: FC<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
setBusy(false);
}, [setBusy, room]);

const startElementCall = useCallback(() => {
setBusy(true);
defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: room.roomId,
view_call: true,
metricsTrigger: undefined,
});
setBusy(false);
}, [setBusy, room]);
const startElementCall = useCallback(
(skipLobby: boolean) => {
setBusy(true);
defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: room.roomId,
view_call: true,
skipLobby: skipLobby,
metricsTrigger: undefined,
});
setBusy(false);
},
[setBusy, room],
);

const { onClick, tooltip, disabled } = useMemo(() => {
if (behavior instanceof DisabledWithReason) {
Expand All @@ -173,7 +177,7 @@ const VideoCallButton: FC<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
return {
onClick: async (ev: ButtonEvent): Promise<void> => {
ev.preventDefault();
startElementCall();
startElementCall("shiftKey" in ev ? ev.shiftKey : false);
},
disabled: false,
};
Expand Down Expand Up @@ -202,7 +206,7 @@ const VideoCallButton: FC<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
(ev: ButtonEvent) => {
ev.preventDefault();
closeMenu();
startElementCall();
startElementCall("shiftKey" in ev ? ev.shiftKey : false);
},
[closeMenu, startElementCall],
);
Expand Down Expand Up @@ -305,7 +309,7 @@ const CallButtons: FC<CallButtonsProps> = ({ room }) => {
} else {
return makeVideoCallButton(new DisabledWithReason(_t("voip|disabled_no_perms_start_video_call")));
}
} else if (hasLegacyCall || hasJitsiWidget || hasGroupCall) {
} else if (hasLegacyCall || hasJitsiWidget) {
return (
<>
{makeVoiceCallButton(new DisabledWithReason(_t("voip|disabled_ongoing_call")))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/rooms/LiveContentSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const LiveContentSummary: FC<Props> = ({ type, text, active, participantC
{" • "}
<span
className="mx_LiveContentSummary_participants"
aria-label={_t("common|n_participants", { count: participantCount })}
aria-label={_t("voip|n_people_joined", { count: participantCount })}
>
{participantCount}
</span>
Expand Down
8 changes: 8 additions & 0 deletions src/components/views/rooms/RoomTileCallSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ export const RoomTileCallSummary: FC<Props> = ({ call }) => {
text = _t("common|video");
active = false;
break;
case ConnectionState.WidgetLoading:
text = _t("common|loading");
active = false;
break;
case ConnectionState.Lobby:
text = _t("common|lobby");
active = false;
break;
case ConnectionState.Connecting:
text = _t("room|joining");
active = true;
Expand Down
Loading
Loading