From 32907764b3b2c2fb4986afbdcf4459446db97e10 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 11 Jul 2022 13:23:03 +0100 Subject: [PATCH] Add ptt URL param to control what mode rooms are created in --- src/room/GroupCallLoader.jsx | 11 +++++++++-- src/room/RoomPage.jsx | 15 ++++++++++++--- src/room/useLoadGroupCall.js | 12 +++++++++--- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/room/GroupCallLoader.jsx b/src/room/GroupCallLoader.jsx index dd327f9..f074128 100644 --- a/src/room/GroupCallLoader.jsx +++ b/src/room/GroupCallLoader.jsx @@ -19,12 +19,19 @@ import { useLoadGroupCall } from "./useLoadGroupCall"; import { ErrorView, FullScreenView } from "../FullScreenView"; import { usePageTitle } from "../usePageTitle"; -export function GroupCallLoader({ client, roomId, viaServers, children }) { +export function GroupCallLoader({ + client, + roomId, + viaServers, + createPtt, + children, +}) { const { loading, error, groupCall } = useLoadGroupCall( client, roomId, viaServers, - true + true, + createPtt ); usePageTitle(groupCall ? groupCall.room.name : "Loading..."); diff --git a/src/room/RoomPage.jsx b/src/room/RoomPage.jsx index ae3c927..1fe7eea 100644 --- a/src/room/RoomPage.jsx +++ b/src/room/RoomPage.jsx @@ -29,9 +29,13 @@ export function RoomPage() { const { roomId: maybeRoomId } = useParams(); const { hash, search } = useLocation(); - const [viaServers, isEmbedded] = useMemo(() => { + const [viaServers, isEmbedded, isPtt] = useMemo(() => { const params = new URLSearchParams(search); - return [params.getAll("via"), params.has("embed")]; + return [ + params.getAll("via"), + params.has("embed"), + params.get("ptt") === "true", + ]; }, [search]); const roomId = (maybeRoomId || hash || "").toLowerCase(); @@ -49,7 +53,12 @@ export function RoomPage() { return ( - + {(groupCall) => ( setState((prevState) => ({ ...prevState, loading: false, error })) ); - }, [client, roomId, state.reloadId, createIfNotFound, viaServers]); + }, [client, roomId, state.reloadId, createIfNotFound, viaServers, createPtt]); return state; }