diff --git a/src/Avatar.test.tsx b/src/Avatar.test.tsx index c5d5e25af..dcac076b9 100644 --- a/src/Avatar.test.tsx +++ b/src/Avatar.test.tsx @@ -30,9 +30,6 @@ const TestComponent: FC< value={{ state: "valid", disconnected: false, - supportedFeatures: { - reactions: true, - }, setClient: vi.fn(), authenticated: { client, diff --git a/src/ClientContext.tsx b/src/ClientContext.tsx index be041612b..0d0aee56c 100644 --- a/src/ClientContext.tsx +++ b/src/ClientContext.tsx @@ -21,7 +21,6 @@ import { type ISyncStateData, type SyncState } from "matrix-js-sdk/lib/sync"; import { ClientEvent, type MatrixClient } from "matrix-js-sdk"; import { ErrorPage } from "./FullScreenView"; -import { useHostBridge } from "./HostBridge"; import { useLeaveToHome } from "./LeaveToHomeContext"; import { PosthogAnalytics, @@ -45,9 +44,6 @@ export type ValidClientState = { // 'Disconnected' rather than 'connected' because it tracks specifically // whether the client is supposed to be connected but is not disconnected: boolean; - supportedFeatures: { - reactions: boolean; - }; setClient: (client: MatrixClient, session: Session) => void; }; @@ -172,7 +168,6 @@ export type ClientLoader = ( export const ClientProvider: FC = ({ children, client, loadClient }) => { const leaveToHome = useLeaveToHome(); - const hostBridge = useHostBridge(); // null = signed out, undefined = loading const [initClientState, setInitClientState] = useState< @@ -306,7 +301,6 @@ export const ClientProvider: FC = ({ children, client, loadClient }) => { ); const [isDisconnected, setIsDisconnected] = useState(false); - const [supportsReactions, setSupportsReactions] = useState(false); const state: ClientState | undefined = useMemo(() => { if (alreadyOpenedErr) { @@ -330,9 +324,6 @@ export const ClientProvider: FC = ({ children, client, loadClient }) => { authenticated, setClient, disconnected: isDisconnected, - supportedFeatures: { - reactions: supportsReactions, - }, }; }, [ alreadyOpenedErr, @@ -341,7 +332,6 @@ export const ClientProvider: FC = ({ children, client, loadClient }) => { logout, setClient, isDisconnected, - supportsReactions, ]); const onSync = useCallback( @@ -366,16 +356,12 @@ export const ClientProvider: FC = ({ children, client, loadClient }) => { initClientState.client.on(ClientEvent.Sync, onSync); } - if (!hostBridge.supportsReactions) - logger.warn("The host does not permit reactions"); - setSupportsReactions(hostBridge.supportsReactions); - return (): void => { if (initClientState.client) { initClientState.client.removeListener(ClientEvent.Sync, onSync); } }; - }, [initClientState, onSync, hostBridge]); + }, [initClientState, onSync]); if (alreadyOpenedErr) { return ; diff --git a/src/reactions/useReactionsSender.tsx b/src/reactions/useReactionsSender.tsx index 1b7e099a2..1277fbbf8 100644 --- a/src/reactions/useReactionsSender.tsx +++ b/src/reactions/useReactionsSender.tsx @@ -18,7 +18,7 @@ import { type MatrixRTCSession } from "matrix-js-sdk/lib/matrixrtc"; import { logger } from "matrix-js-sdk/lib/logger"; import { useMatrixRTCSessionMemberships } from "../useMatrixRTCSessionMemberships"; -import { useClientState } from "../ClientContext"; +import { useHostBridge } from "../HostBridge"; import { ElementCallReactionEventType, type ReactionOption } from "."; import { type CallViewModel } from "../state/CallViewModel/CallViewModel"; import { useBehavior } from "../useBehavior"; @@ -54,9 +54,7 @@ export const ReactionsSenderProvider = ({ vm: CallViewModel; }): JSX.Element => { const memberships = useMatrixRTCSessionMemberships(rtcSession); - const clientState = useClientState(); - const supportsReactions = - clientState?.state === "valid" && clientState.supportedFeatures.reactions; + const { supportsReactions } = useHostBridge(); const room = rtcSession.room; const myUserId = room.client.getUserId(); const myDeviceId = room.client.getDeviceId(); diff --git a/src/settings/useSubmitRageshake.test.tsx b/src/settings/useSubmitRageshake.test.tsx index 396b04316..60b55bbd6 100644 --- a/src/settings/useSubmitRageshake.test.tsx +++ b/src/settings/useSubmitRageshake.test.tsx @@ -78,9 +78,6 @@ function renderWithMockClient( value={{ state: "valid", disconnected: false, - supportedFeatures: { - reactions: true, - }, setClient: vi.fn(), authenticated: { client,