diff --git a/packages/restapi/src/lib/spaceV2/acceptInvite.ts b/packages/restapi/src/lib/spaceV2/acceptInvite.ts index aa750a373..2b95eac81 100644 --- a/packages/restapi/src/lib/spaceV2/acceptInvite.ts +++ b/packages/restapi/src/lib/spaceV2/acceptInvite.ts @@ -1,3 +1,12 @@ +/** + * @file acceptInvite + * This file defines functions related to accepting invites + * and managing connections within the SpaceV2 class. + * It includes the `acceptInvite` function, + * which handles incoming invitations and manages peer connections, + * as well as related utility functions. + */ + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import * as Peer from 'simple-peer'; @@ -121,12 +130,6 @@ export async function acceptInvite( }); peerConnection.on('connect', () => { - peerConnection.send( - JSON.stringify({ - type: 'isVideoOn', - value: this.data.local.video, - }) - ); peerConnection.send( JSON.stringify({ type: 'isAudioOn', diff --git a/packages/restapi/src/lib/spaceV2/inviteToJoin.ts b/packages/restapi/src/lib/spaceV2/inviteToJoin.ts index b187759c9..0f02a44b1 100644 --- a/packages/restapi/src/lib/spaceV2/inviteToJoin.ts +++ b/packages/restapi/src/lib/spaceV2/inviteToJoin.ts @@ -128,12 +128,6 @@ export async function inviteToJoin( peerConnection.send( `initial message from ${senderAddress}` ); - peerConnection.send( - JSON.stringify({ - type: 'isVideoOn', - value: this.data.local.video, - }) - ); peerConnection.send( JSON.stringify({ type: 'isAudioOn', @@ -146,7 +140,7 @@ export async function inviteToJoin( if (isJSON(data)) { const parsedData = JSON.parse(data); - if (parsedData.type === 'isVideoOn' || parsedData.type === 'isAudioOn') { + if (parsedData.type === 'isAudioOn') { console.log(`IS ${parsedData.type.toUpperCase()}`, parsedData.value); this.setSpaceV2Data((oldData) => { @@ -167,12 +161,7 @@ export async function inviteToJoin( // If the peer is found in either array, update the property if (arrayToUpdate) { - if (parsedData.type === 'isVideoOn') { - arrayToUpdate[indexInIncoming !== -1 ? indexInIncoming : indexInPending].video = parsedData.value; - } - if (parsedData.type === 'isAudioOn') { - arrayToUpdate[indexInIncoming !== -1 ? indexInIncoming : indexInPending].audio = parsedData.value; - } + arrayToUpdate[indexInIncoming !== -1 ? indexInIncoming : indexInPending].audio = parsedData.value; } }); });