Compare commits

...

9 Commits

Author SHA1 Message Date
David Baker
34d5e88def Merge pull request #564 from vector-im/dbkr/fix_multiple_group_calls
Fix bug where additional group calls could be created
2022-09-01 16:18:43 +01:00
David Baker
30c9dfce02 Remove unused import 2022-09-01 13:36:02 +01:00
David Baker
48ad4d040d Actually wait for the right event
& update js-sdk dependency
2022-09-01 13:32:11 +01:00
David Baker
1b4f097b1c Fix bug where additional group calls could be created
This (hopefully) fixes the remaining bug where extra group calls
could be created when entering a room.

We waited for the Room event to arrive, but didn't wait for the
group call event handler to actually process the event, so it would
have depended what order the event handlers were run in.

If this doesn't fix it, it at least adds logging so we'll have more
to go on next time.

Fixes https://github.com/vector-im/element-call/issues/563
2022-09-01 11:41:22 +01:00
David Baker
7b6193ab62 Update js-sdk for ICE end-of-candidates fix 2022-08-26 10:06:18 +01:00
David Baker
10a2733fd5 Merge pull request #552 from vector-im/dbkr/fix_rageshake_groupcall_txt
Fix groupcall debug info in rageshakes
2022-08-25 15:20:47 +01:00
David Baker
e7353e184f Fix groupcall debug info in rageshakes
We were putting the whole array from setState in, so the debug info
was wrapped in an array when it shouldn't be.

Also comment the groupCallInspector setState/context dance which I
now *finally* understand.
2022-08-25 11:43:47 +01:00
David Baker
a479863f88 Merge pull request #551 from vector-im/dbkr/fix_rageshake_form
Fix 'submit debug logs' checkbox in the rageshake form
2022-08-24 09:53:47 +01:00
David Baker
c550545116 Fix 'submit debug logs' checkbox in the rageshake form
Fixes https://github.com/vector-im/element-call/issues/550
2022-08-23 20:29:41 +01:00
6 changed files with 29 additions and 17 deletions

View File

@@ -38,7 +38,7 @@
"classnames": "^2.3.1",
"color-hash": "^2.0.1",
"events": "^3.3.0",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#45e56f8cc36c459ed43e405be4206e5e66b3ad98",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#da5bc358f40e1e9de39d28aea072a9c38e356bda",
"matrix-widget-api": "^1.0.0",
"mermaid": "^8.13.8",
"normalize.css": "^8.0.1",

View File

@@ -43,9 +43,7 @@ export function FeedbackModal({ inCall, roomId, onClose, ...rest }: Props) {
const descriptionData = data.get("description");
const description =
typeof descriptionData === "string" ? descriptionData : "";
const sendLogsData = data.get("sendLogs");
const sendLogs =
typeof sendLogsData === "string" ? sendLogsData === "true" : false;
const sendLogs = Boolean(data.get("sendLogs"));
const rageshakeRequestId = randomString(16);
submitRageshake({

View File

@@ -121,8 +121,11 @@ export function InspectorContextProvider({
}: {
children: React.ReactNode;
}) {
// The context will be initialized empty.
// It is then set from within GroupCallInspector.
// We take the tuple of [currentState, setter] and stick
// it straight into the context for other things to call
// the setState method... this feels like a fairly severe
// contortion of the hooks API - is this really the best way
// to do this?
const context = useState<InspectorContextState>({});
return (
<InspectorContext.Provider value={context}>

View File

@@ -21,7 +21,7 @@ import {
GroupCallIntent,
} from "matrix-js-sdk/src/webrtc/groupCall";
import { GroupCallEventHandlerEvent } from "matrix-js-sdk/src/webrtc/groupCallEventHandler";
import { ClientEvent } from "matrix-js-sdk/src/client";
import { logger } from "matrix-js-sdk/src/logger";
import type { MatrixClient } from "matrix-js-sdk/src/client";
import type { Room } from "matrix-js-sdk/src/models/room";
@@ -53,11 +53,11 @@ export const useLoadGroupCall = (
const waitPromise = new Promise<Room>((resolve) => {
const onRoomEvent = async (room: Room) => {
if (room.roomId === roomId) {
client.removeListener(ClientEvent.Room, onRoomEvent);
client.removeListener(GroupCallEventHandlerEvent.Room, onRoomEvent);
resolve(room);
}
};
client.on(ClientEvent.Room, onRoomEvent);
client.on(GroupCallEventHandlerEvent.Room, onRoomEvent);
});
// race the promise with a timeout so we don't
@@ -74,6 +74,7 @@ export const useLoadGroupCall = (
const fetchOrCreateRoom = async (): Promise<Room> => {
try {
const room = await client.joinRoom(roomIdOrAlias, { viaServers });
logger.info(`Joined ${roomIdOrAlias}, waiting for Room event`);
// wait for the room to come down the sync stream, otherwise
// client.getRoom() won't return the room.
return waitForRoom(room.roomId);
@@ -100,7 +101,9 @@ export const useLoadGroupCall = (
const fetchOrCreateGroupCall = async (): Promise<GroupCall> => {
const room = await fetchOrCreateRoom();
logger.debug(`Fetched / joined room ${roomIdOrAlias}`);
const groupCall = client.getGroupCallForRoom(room.roomId);
logger.debug("Got group call", groupCall);
if (groupCall) return groupCall;
@@ -111,7 +114,11 @@ export const useLoadGroupCall = (
)
) {
// The call doesn't exist, but we can create it
console.log(`Creating ${createPtt ? "PTT" : "video"} group call room`);
console.log(
`No call found in ${roomIdOrAlias}: creating ${
createPtt ? "PTT" : "video"
} call`
);
return await client.createGroupCall(
room.roomId,
createPtt ? GroupCallType.Voice : GroupCallType.Video,

View File

@@ -40,7 +40,9 @@ export function useSubmitRageshake(): {
error: Error;
} {
const client: MatrixClient = useClient().client;
const json = useContext(InspectorContext);
// The value of the context is the whole tuple returned from setState,
// so we just want the current state.
const [inspectorState] = useContext(InspectorContext);
const [{ sending, sent, error }, setState] = useState({
sending: false,
@@ -231,10 +233,12 @@ export function useSubmitRageshake(): {
body.append("compressed-log", new Blob([buf]), entry.id);
}
if (json) {
if (inspectorState) {
body.append(
"file",
new Blob([JSON.stringify(json)], { type: "text/plain" }),
new Blob([JSON.stringify(inspectorState)], {
type: "text/plain",
}),
"groupcall.txt"
);
}
@@ -262,7 +266,7 @@ export function useSubmitRageshake(): {
console.error(error);
}
},
[client, json, sending]
[client, inspectorState, sending]
);
return {

View File

@@ -8390,9 +8390,9 @@ matrix-events-sdk@^0.0.1-beta.7:
resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1-beta.7.tgz#5ffe45eba1f67cc8d7c2377736c728b322524934"
integrity sha512-9jl4wtWanUFSy2sr2lCjErN/oC8KTAtaeaozJtrgot1JiQcEI4Rda9OLgQ7nLKaqb4Z/QUx/fR3XpDzm5Jy1JA==
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#3334c01191bcd82b5243916284c9a08d08fd9795":
version "19.2.0"
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/3334c01191bcd82b5243916284c9a08d08fd9795"
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#da5bc358f40e1e9de39d28aea072a9c38e356bda":
version "19.3.0"
resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/da5bc358f40e1e9de39d28aea072a9c38e356bda"
dependencies:
"@babel/runtime" "^7.12.5"
"@types/sdp-transform" "^2.4.5"