diff --git a/src/app/features/room/CallView.tsx b/src/app/features/call/CallView.tsx similarity index 94% rename from src/app/features/room/CallView.tsx rename to src/app/features/call/CallView.tsx index f1e0a4ec..eed5bd32 100644 --- a/src/app/features/room/CallView.tsx +++ b/src/app/features/call/CallView.tsx @@ -1,9 +1,8 @@ /* eslint-disable no-nested-ternary */ import { Room } from 'matrix-js-sdk'; -import React, { useContext, useMemo } from 'react'; -import { useCallback, useEffect, useRef } from 'react'; +import React, { useContext, useMemo, useCallback, useEffect, useRef } from 'react'; import { Box } from 'folds'; -import { RoomViewHeader } from './RoomViewHeader'; +import { RoomViewHeader } from '../room/RoomViewHeader'; import { useCallState } from '../../pages/client/call/CallProvider'; import { PrimaryRefContext, @@ -34,11 +33,6 @@ type OriginalStyles = { border?: string; }; -interface CallViewOutletContext { - primaryIframeRef: React.RefObject; - backupIframeRef: React.RefObject; -} - export function CallView({ room, eventId }: { room: Room; eventId?: string }) { const primaryIframeRef = useContext(PrimaryRefContext); const backupIframeRef = useContext(BackupRefContext); diff --git a/src/app/features/room/CinnyWidget.ts b/src/app/features/call/CinnyWidget.ts similarity index 100% rename from src/app/features/room/CinnyWidget.ts rename to src/app/features/call/CinnyWidget.ts diff --git a/src/app/features/room/SmallWidget.ts b/src/app/features/call/SmallWidget.ts similarity index 100% rename from src/app/features/room/SmallWidget.ts rename to src/app/features/call/SmallWidget.ts diff --git a/src/app/features/room/SmallWidgetDriver.ts b/src/app/features/call/SmallWidgetDriver.ts similarity index 97% rename from src/app/features/room/SmallWidgetDriver.ts rename to src/app/features/call/SmallWidgetDriver.ts index 163787a0..6764bb40 100644 --- a/src/app/features/room/SmallWidgetDriver.ts +++ b/src/app/features/call/SmallWidgetDriver.ts @@ -1,3 +1,8 @@ +/* eslint-disable no-return-await */ +/* eslint-disable no-param-reassign */ +/* eslint-disable no-continue */ +/* eslint-disable class-methods-use-this */ +/* eslint-disable no-dupe-class-members */ /* * Copyright 2024 New Vector Ltd. * Copyright 2020-2023 The Matrix.org Foundation C.I.C. @@ -22,7 +27,6 @@ import { type IGetMediaConfigResult, type UpdateDelayedEventAction, OpenIDRequestState, - IOpenIDCredentials, SimpleObservable, IOpenIDUpdate, } from 'matrix-widget-api'; @@ -123,6 +127,7 @@ export class SmallWidgetDriver extends WidgetDriver { EventType.RoomRedaction, 'io.element.call.reaction', ]; + // eslint-disable-next-line no-restricted-syntax for (const eventType of sendRecvRoomEvents) { this.allowedCapabilities.add( WidgetEventCapability.forRoomEvent(EventDirection.Send, eventType).raw @@ -145,6 +150,7 @@ export class SmallWidgetDriver extends WidgetDriver { EventType.CallReplaces, EventType.CallEncryptionKeysPrefix, ]; + // eslint-disable-next-line no-restricted-syntax for (const eventType of sendRecvToDevice) { this.allowedCapabilities.add( WidgetEventCapability.forToDeviceEvent(EventDirection.Send, eventType).raw @@ -166,12 +172,14 @@ export class SmallWidgetDriver extends WidgetDriver { stateKey: string | null, targetRoomId: string | null ): Promise; + public async sendEvent( eventType: K, content: TimelineEvents[K], stateKey: null, targetRoomId: string | null ): Promise; + public async sendEvent( eventType: string, content: IContent, @@ -194,7 +202,7 @@ export class SmallWidgetDriver extends WidgetDriver { ); } else if (eventType === EventType.RoomRedaction) { // special case: extract the `redacts` property and call redact - r = await client.redactEvent(roomId, content['redacts']); + r = await client.redactEvent(roomId, content.redacts); } else { // message event r = await client.sendEvent( @@ -219,6 +227,7 @@ export class SmallWidgetDriver extends WidgetDriver { stateKey: string | null, targetRoomId: string | null ): Promise; + /** * @experimental Part of MSC4140 & MSC4157 */ @@ -230,6 +239,7 @@ export class SmallWidgetDriver extends WidgetDriver { stateKey: null, targetRoomId: string | null ): Promise; + public async sendDelayedEvent( delay: number | null, parentDelayId: string | null, @@ -315,8 +325,10 @@ export class SmallWidgetDriver extends WidgetDriver { // attempt to re-batch these up into a single request const invertedContentMap: { [content: string]: { userId: string; deviceId: string }[] } = {}; + // eslint-disable-next-line no-restricted-syntax for (const userId of Object.keys(contentMap)) { const userContentMap = contentMap[userId]; + // eslint-disable-next-line no-restricted-syntax for (const deviceId of Object.keys(userContentMap)) { const content = userContentMap[deviceId]; const stringifiedContent = JSON.stringify(content); @@ -386,7 +398,7 @@ export class SmallWidgetDriver extends WidgetDriver { if (since !== undefined && ev.getId() === since) break; if (ev.getType() !== eventType || ev.isState()) continue; - if (eventType === EventType.RoomMessage && msgtype && msgtype !== ev.getContent()['msgtype']) + if (eventType === EventType.RoomMessage && msgtype && msgtype !== ev.getContent().msgtype) continue; if (ev.getStateKey() !== undefined && stateKey !== undefined && ev.getStateKey() !== stateKey) continue; diff --git a/src/app/pages/client/call/PersistentCallContainer.tsx b/src/app/pages/client/call/PersistentCallContainer.tsx index abe17591..a3741673 100644 --- a/src/app/pages/client/call/PersistentCallContainer.tsx +++ b/src/app/pages/client/call/PersistentCallContainer.tsx @@ -9,7 +9,7 @@ import { SmallWidget, getWidgetData, getWidgetUrl, -} from '../../../features/room/SmallWidget'; +} from '../../../features/call/SmallWidget'; import { useMatrixClient } from '../../../hooks/useMatrixClient'; import { useClientConfig } from '../../../hooks/useClientConfig'; import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize'; @@ -127,7 +127,6 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro widgetApiInstance.once('ready', () => { logger.info(`PersistentCallContainer: Widget for ${roomIdToSet} is ready.`); }); - } } },