mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-09-15 15:22:25 +03:00
Move files to more correct location
This commit is contained in:
parent
c108295e5a
commit
d54bc2c110
5 changed files with 18 additions and 13 deletions
|
@ -1,9 +1,8 @@
|
||||||
/* eslint-disable no-nested-ternary */
|
/* eslint-disable no-nested-ternary */
|
||||||
import { Room } from 'matrix-js-sdk';
|
import { Room } from 'matrix-js-sdk';
|
||||||
import React, { useContext, useMemo } from 'react';
|
import React, { useContext, useMemo, useCallback, useEffect, useRef } from 'react';
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
|
||||||
import { Box } from 'folds';
|
import { Box } from 'folds';
|
||||||
import { RoomViewHeader } from './RoomViewHeader';
|
import { RoomViewHeader } from '../room/RoomViewHeader';
|
||||||
import { useCallState } from '../../pages/client/call/CallProvider';
|
import { useCallState } from '../../pages/client/call/CallProvider';
|
||||||
import {
|
import {
|
||||||
PrimaryRefContext,
|
PrimaryRefContext,
|
||||||
|
@ -34,11 +33,6 @@ type OriginalStyles = {
|
||||||
border?: string;
|
border?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface CallViewOutletContext {
|
|
||||||
primaryIframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
||||||
backupIframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function CallView({ room, eventId }: { room: Room; eventId?: string }) {
|
export function CallView({ room, eventId }: { room: Room; eventId?: string }) {
|
||||||
const primaryIframeRef = useContext(PrimaryRefContext);
|
const primaryIframeRef = useContext(PrimaryRefContext);
|
||||||
const backupIframeRef = useContext(BackupRefContext);
|
const backupIframeRef = useContext(BackupRefContext);
|
|
@ -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 2024 New Vector Ltd.
|
||||||
* Copyright 2020-2023 The Matrix.org Foundation C.I.C.
|
* Copyright 2020-2023 The Matrix.org Foundation C.I.C.
|
||||||
|
@ -22,7 +27,6 @@ import {
|
||||||
type IGetMediaConfigResult,
|
type IGetMediaConfigResult,
|
||||||
type UpdateDelayedEventAction,
|
type UpdateDelayedEventAction,
|
||||||
OpenIDRequestState,
|
OpenIDRequestState,
|
||||||
IOpenIDCredentials,
|
|
||||||
SimpleObservable,
|
SimpleObservable,
|
||||||
IOpenIDUpdate,
|
IOpenIDUpdate,
|
||||||
} from 'matrix-widget-api';
|
} from 'matrix-widget-api';
|
||||||
|
@ -123,6 +127,7 @@ export class SmallWidgetDriver extends WidgetDriver {
|
||||||
EventType.RoomRedaction,
|
EventType.RoomRedaction,
|
||||||
'io.element.call.reaction',
|
'io.element.call.reaction',
|
||||||
];
|
];
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const eventType of sendRecvRoomEvents) {
|
for (const eventType of sendRecvRoomEvents) {
|
||||||
this.allowedCapabilities.add(
|
this.allowedCapabilities.add(
|
||||||
WidgetEventCapability.forRoomEvent(EventDirection.Send, eventType).raw
|
WidgetEventCapability.forRoomEvent(EventDirection.Send, eventType).raw
|
||||||
|
@ -145,6 +150,7 @@ export class SmallWidgetDriver extends WidgetDriver {
|
||||||
EventType.CallReplaces,
|
EventType.CallReplaces,
|
||||||
EventType.CallEncryptionKeysPrefix,
|
EventType.CallEncryptionKeysPrefix,
|
||||||
];
|
];
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const eventType of sendRecvToDevice) {
|
for (const eventType of sendRecvToDevice) {
|
||||||
this.allowedCapabilities.add(
|
this.allowedCapabilities.add(
|
||||||
WidgetEventCapability.forToDeviceEvent(EventDirection.Send, eventType).raw
|
WidgetEventCapability.forToDeviceEvent(EventDirection.Send, eventType).raw
|
||||||
|
@ -166,12 +172,14 @@ export class SmallWidgetDriver extends WidgetDriver {
|
||||||
stateKey: string | null,
|
stateKey: string | null,
|
||||||
targetRoomId: string | null
|
targetRoomId: string | null
|
||||||
): Promise<ISendEventDetails>;
|
): Promise<ISendEventDetails>;
|
||||||
|
|
||||||
public async sendEvent<K extends keyof TimelineEvents>(
|
public async sendEvent<K extends keyof TimelineEvents>(
|
||||||
eventType: K,
|
eventType: K,
|
||||||
content: TimelineEvents[K],
|
content: TimelineEvents[K],
|
||||||
stateKey: null,
|
stateKey: null,
|
||||||
targetRoomId: string | null
|
targetRoomId: string | null
|
||||||
): Promise<ISendEventDetails>;
|
): Promise<ISendEventDetails>;
|
||||||
|
|
||||||
public async sendEvent(
|
public async sendEvent(
|
||||||
eventType: string,
|
eventType: string,
|
||||||
content: IContent,
|
content: IContent,
|
||||||
|
@ -194,7 +202,7 @@ export class SmallWidgetDriver extends WidgetDriver {
|
||||||
);
|
);
|
||||||
} else if (eventType === EventType.RoomRedaction) {
|
} else if (eventType === EventType.RoomRedaction) {
|
||||||
// special case: extract the `redacts` property and call redact
|
// special case: extract the `redacts` property and call redact
|
||||||
r = await client.redactEvent(roomId, content['redacts']);
|
r = await client.redactEvent(roomId, content.redacts);
|
||||||
} else {
|
} else {
|
||||||
// message event
|
// message event
|
||||||
r = await client.sendEvent(
|
r = await client.sendEvent(
|
||||||
|
@ -219,6 +227,7 @@ export class SmallWidgetDriver extends WidgetDriver {
|
||||||
stateKey: string | null,
|
stateKey: string | null,
|
||||||
targetRoomId: string | null
|
targetRoomId: string | null
|
||||||
): Promise<ISendDelayedEventDetails>;
|
): Promise<ISendDelayedEventDetails>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @experimental Part of MSC4140 & MSC4157
|
* @experimental Part of MSC4140 & MSC4157
|
||||||
*/
|
*/
|
||||||
|
@ -230,6 +239,7 @@ export class SmallWidgetDriver extends WidgetDriver {
|
||||||
stateKey: null,
|
stateKey: null,
|
||||||
targetRoomId: string | null
|
targetRoomId: string | null
|
||||||
): Promise<ISendDelayedEventDetails>;
|
): Promise<ISendDelayedEventDetails>;
|
||||||
|
|
||||||
public async sendDelayedEvent(
|
public async sendDelayedEvent(
|
||||||
delay: number | null,
|
delay: number | null,
|
||||||
parentDelayId: string | null,
|
parentDelayId: string | null,
|
||||||
|
@ -315,8 +325,10 @@ export class SmallWidgetDriver extends WidgetDriver {
|
||||||
// attempt to re-batch these up into a single request
|
// attempt to re-batch these up into a single request
|
||||||
const invertedContentMap: { [content: string]: { userId: string; deviceId: string }[] } = {};
|
const invertedContentMap: { [content: string]: { userId: string; deviceId: string }[] } = {};
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const userId of Object.keys(contentMap)) {
|
for (const userId of Object.keys(contentMap)) {
|
||||||
const userContentMap = contentMap[userId];
|
const userContentMap = contentMap[userId];
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
for (const deviceId of Object.keys(userContentMap)) {
|
for (const deviceId of Object.keys(userContentMap)) {
|
||||||
const content = userContentMap[deviceId];
|
const content = userContentMap[deviceId];
|
||||||
const stringifiedContent = JSON.stringify(content);
|
const stringifiedContent = JSON.stringify(content);
|
||||||
|
@ -386,7 +398,7 @@ export class SmallWidgetDriver extends WidgetDriver {
|
||||||
if (since !== undefined && ev.getId() === since) break;
|
if (since !== undefined && ev.getId() === since) break;
|
||||||
|
|
||||||
if (ev.getType() !== eventType || ev.isState()) continue;
|
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;
|
continue;
|
||||||
if (ev.getStateKey() !== undefined && stateKey !== undefined && ev.getStateKey() !== stateKey)
|
if (ev.getStateKey() !== undefined && stateKey !== undefined && ev.getStateKey() !== stateKey)
|
||||||
continue;
|
continue;
|
|
@ -9,7 +9,7 @@ import {
|
||||||
SmallWidget,
|
SmallWidget,
|
||||||
getWidgetData,
|
getWidgetData,
|
||||||
getWidgetUrl,
|
getWidgetUrl,
|
||||||
} from '../../../features/room/SmallWidget';
|
} from '../../../features/call/SmallWidget';
|
||||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||||
import { useClientConfig } from '../../../hooks/useClientConfig';
|
import { useClientConfig } from '../../../hooks/useClientConfig';
|
||||||
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
|
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
|
||||||
|
@ -127,7 +127,6 @@ export function PersistentCallContainer({ children }: PersistentCallContainerPro
|
||||||
widgetApiInstance.once('ready', () => {
|
widgetApiInstance.once('ready', () => {
|
||||||
logger.info(`PersistentCallContainer: Widget for ${roomIdToSet} is ready.`);
|
logger.info(`PersistentCallContainer: Widget for ${roomIdToSet} is ready.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue