Skip to content

Commit 826db44

Browse files
committed
Read url params for auto leave
1 parent b036bb4 commit 826db44

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/UrlParams.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ export interface UrlParams {
7171
* is window.controls.onBackButtonPressed.
7272
*/
7373
header: HeaderStyle;
74+
/**
75+
* If we want the app to automatically leave the call when all other participants
76+
* leave the call.
77+
*
78+
* This is used in settings where EC should behave more like a phone call other than a conference.
79+
* Like in a DM.
80+
*/
81+
telephoneAutoLeave: boolean;
7482
/**
7583
* Whether the controls should be shown. For screen recording no controls can be desired.
7684
*/
@@ -329,6 +337,7 @@ export const getUrlParams = (
329337
rageshakeSubmitUrl: parser.getParam("rageshakeSubmitUrl"),
330338
sentryDsn: parser.getParam("sentryDsn"),
331339
sentryEnvironment: parser.getParam("sentryEnvironment"),
340+
telephoneAutoLeave: parser.getFlagParam("telephoneAutoLeave"),
332341
};
333342
};
334343

src/room/GroupCallView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,18 @@ export const GroupCallView: FC<Props> = ({
166166
const { displayName, avatarUrl } = useProfile(client);
167167
const roomName = useRoomName(room);
168168
const roomAvatar = useRoomAvatar(room);
169-
const { perParticipantE2EE, returnToLobby } = useUrlParams();
169+
const {
170+
perParticipantE2EE,
171+
returnToLobby,
172+
password: passwordFromUrl,
173+
} = useUrlParams();
170174
const e2eeSystem = useRoomEncryptionSystem(room.roomId);
171175
const [useNewMembershipManager] = useSetting(useNewMembershipManagerSetting);
172176
const [useExperimentalToDeviceTransport] = useSetting(
173177
useExperimentalToDeviceTransportSetting,
174178
);
175179

176180
// Save the password once we start the groupCallView
177-
const { password: passwordFromUrl } = useUrlParams();
178181
useEffect(() => {
179182
if (passwordFromUrl) saveKeyForRoom(room.roomId, passwordFromUrl);
180183
}, [passwordFromUrl, room.roomId]);

src/room/InCallView.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ export const ActiveCall: FC<ActiveCallProps> = (props) => {
162162
};
163163
}, [livekitRoom]);
164164

165+
const { telephoneAutoLeave } = useUrlParams();
166+
165167
useEffect(() => {
166168
if (livekitRoom !== undefined) {
167169
const reactionsReader = new ReactionsReader(props.rtcSession);
@@ -171,7 +173,7 @@ export const ActiveCall: FC<ActiveCallProps> = (props) => {
171173
mediaDevices,
172174
{
173175
encryptionSystem: props.e2eeSystem,
174-
autoLeaveWhenOthersLeft: undefined,
176+
autoLeaveWhenOthersLeft: telephoneAutoLeave,
175177
},
176178
connStateObservable$,
177179
reactionsReader.raisedHands$,
@@ -189,6 +191,7 @@ export const ActiveCall: FC<ActiveCallProps> = (props) => {
189191
mediaDevices,
190192
props.e2eeSystem,
191193
connStateObservable$,
194+
props.telephoneAutoLeave,
192195
]);
193196

194197
if (livekitRoom === undefined || vm === null) return null;

0 commit comments

Comments
 (0)