Remember whether sidebar is shown for calls when switching rooms (#30262)

* Remember whether sidebar is shown for calls when switching rooms

Stores the sidebar state per-room in LegacyCallHandler, along with other details about calls.

* Hide the Show/Hide Sidebar from the Picture-in-Picture preview

The toggle sidebar button currently does nothing in PIP mode, since PIP mode never shows a sidebar (even when the call is made fullscreen from the PIP preview)

* Add test for Show/Hide Sidebar feature

* Add more tests for LegacyCallView and LegacyCallViewForRoom

Also, fix issue where LegacyCallViewForRoom used roomId and not callId for checking for sidebar state
This commit is contained in:
Bojidar Marinov
2025-09-01 14:33:33 +00:00
committed by GitHub
parent 4d48d1b2f2
commit 8903927e0c
7 changed files with 228 additions and 16 deletions
+38
View File
@@ -585,4 +585,42 @@ describe("LegacyCallHandler without third party protocols", () => {
expect(mockAudioBufferSourceNode.start).not.toHaveBeenCalled();
});
});
describe("sidebar state", () => {
const roomId = "test-room-id";
it("should default to showing sidebar", () => {
const call = new MatrixCall({
client: MatrixClientPeg.safeGet(),
roomId,
});
const cli = MatrixClientPeg.safeGet();
cli.emit(CallEventHandlerEvent.Incoming, call);
expect(callHandler.isCallSidebarShown(call.callId)).toEqual(true);
});
it("should remember sidebar state per call", () => {
const call = new MatrixCall({
client: MatrixClientPeg.safeGet(),
roomId,
});
const cli = MatrixClientPeg.safeGet();
cli.emit(CallEventHandlerEvent.Incoming, call);
expect(callHandler.isCallSidebarShown(call.callId)).toEqual(true);
callHandler.setCallSidebarShown(call.callId, false);
expect(callHandler.isCallSidebarShown(call.callId)).toEqual(false);
call.emit(CallEvent.Hangup, call);
const call2 = new MatrixCall({
client: MatrixClientPeg.safeGet(),
roomId,
});
cli.emit(CallEventHandlerEvent.Incoming, call2);
expect(callHandler.isCallSidebarShown(call2.callId)).toEqual(true);
});
});
});