Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hand raise feature #2542

Open
wants to merge 45 commits into
base: livekit
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
48cf487
Initial support for Hand Raise feature
mgcm Aug 7, 2024
2d1917c
Refactored to use reaction and redaction events
mgcm Sep 8, 2024
f6ae6a0
Replacing button svg with raised hand emoji
mgcm Sep 8, 2024
ac7321d
SpotlightTile should not duplicate the raised hand
mgcm Sep 8, 2024
bcad500
Update src/room/useRaisedHands.tsx
fkwp Sep 9, 2024
0730ba5
Use relations to load existing reactions when joining the call
mgcm Sep 10, 2024
ab5654c
Links to sha commit of matrix-js-sdk that exposes the call membership…
mgcm Sep 10, 2024
7ac5642
Removing RaiseHand.svg
mgcm Sep 10, 2024
69a50fb
Check for reaction & redaction capabilities in widget mode
mgcm Sep 19, 2024
42a7b1e
Fix failing GridTile test
mgcm Sep 19, 2024
16afb56
Center align hand raise.
Half-Shot Oct 25, 2024
1c8e547
Add support for displaying the duration of a raised hand.
Half-Shot Oct 25, 2024
7f268a3
Add a sound for when a hand is raised.
Half-Shot Oct 25, 2024
a23d256
Refactor raised hand indicator and add tests.
Half-Shot Oct 28, 2024
43b4fc0
lint
Half-Shot Oct 28, 2024
4501e67
Refactor into own files.
Half-Shot Oct 28, 2024
4a712dc
Redact the right thing.
Half-Shot Oct 28, 2024
ba921f8
Tidy up useEffect
Half-Shot Oct 28, 2024
9d01e8c
Lint tests
Half-Shot Oct 28, 2024
38878d3
Remove extra layer
Half-Shot Oct 28, 2024
33724ef
Add better sound. (woosh)
Half-Shot Oct 28, 2024
198859d
Add a small mode for spotlight
Half-Shot Oct 28, 2024
07d3451
Fix timestamp calculation on relaod.
Half-Shot Oct 28, 2024
b7e8236
Fix call border resizing video
Half-Shot Oct 29, 2024
23d849b
lint
Half-Shot Oct 29, 2024
f13bd79
Fix and update tests
Half-Shot Oct 29, 2024
dbabf45
Allow timer to be configurable.
Half-Shot Oct 29, 2024
e1a4310
Add preferences tab for choosing to enable timer.
Half-Shot Oct 29, 2024
0b6cf18
Drop border from raised hand icon
Half-Shot Oct 29, 2024
528e692
Handle cases when a new member event happens.
Half-Shot Oct 29, 2024
cd73ad8
Prevent infinite loop
Half-Shot Oct 29, 2024
5a5c1be
Major refactor to support various state problems.
Half-Shot Oct 29, 2024
ff7da13
Tidy up and finish test rewrites
Half-Shot Oct 29, 2024
a45b01d
Add some explanation comments.
Half-Shot Oct 29, 2024
3229498
Even more comments.
Half-Shot Oct 29, 2024
2d95d4f
Use proper duration formatter
Half-Shot Oct 31, 2024
7229f4b
Remove rerender
Half-Shot Oct 31, 2024
a354a40
Fix redactions not working because they pick up events in transit.
Half-Shot Oct 31, 2024
e49eb55
More tidying
Half-Shot Oct 31, 2024
ec9dec8
Use deferred value
Half-Shot Oct 31, 2024
21380c7
linting
Half-Shot Oct 31, 2024
a9e6aa3
Add tests for cases where we got a reaction from someone else.
Half-Shot Oct 31, 2024
167caa3
Merge remote-tracking branch 'origin/livekit' into raise-hand-button
Half-Shot Oct 31, 2024
748cc58
Be even less brittle.
Half-Shot Nov 1, 2024
f54e1e2
Transpose border to GridTile.
Half-Shot Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/locales/en-GB/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"options": "Options",
"password": "Password",
"profile": "Profile",
"raise_hand": "Raise hand",
"settings": "Settings",
"unencrypted": "Not encrypted",
"username": "Username",
Expand Down
45 changes: 24 additions & 21 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import { MediaDevicesProvider } from "./livekit/MediaDevicesContext";
import { widget } from "./widget";
import { useTheme } from "./useTheme";
import { ReactionsProvider } from "./useReactions";

Check warning on line 31 in src/App.tsx

View check run for this annotation

Codecov / codecov/patch

src/App.tsx#L31

Added line #L31 was not covered by tests

const SentryRoute = Sentry.withSentryRouting(Route);

Expand Down Expand Up @@ -82,27 +83,29 @@
<TooltipProvider>
{loaded ? (
<Suspense fallback={null}>
<ClientProvider>
<MediaDevicesProvider>
<Sentry.ErrorBoundary fallback={errorPage}>
<DisconnectedBanner />
<Switch>
<SentryRoute exact path="/">
<HomePage />
</SentryRoute>
<SentryRoute exact path="/login">
<LoginPage />
</SentryRoute>
<SentryRoute exact path="/register">
<RegisterPage />
</SentryRoute>
<SentryRoute path="*">
<RoomPage />
</SentryRoute>
</Switch>
</Sentry.ErrorBoundary>
</MediaDevicesProvider>
</ClientProvider>
<ReactionsProvider>
<ClientProvider>
<MediaDevicesProvider>
<Sentry.ErrorBoundary fallback={errorPage}>
<DisconnectedBanner />
<Switch>
<SentryRoute exact path="/">
<HomePage />
</SentryRoute>
<SentryRoute exact path="/login">
<LoginPage />
</SentryRoute>
<SentryRoute exact path="/register">
<RegisterPage />
</SentryRoute>
<SentryRoute path="*">
<RoomPage />
</SentryRoute>
</Switch>
</Sentry.ErrorBoundary>
</MediaDevicesProvider>
</ClientProvider>
</ReactionsProvider>

Check warning on line 108 in src/App.tsx

View check run for this annotation

Codecov / codecov/patch

src/App.tsx#L86-L108

Added lines #L86 - L108 were not covered by tests
</Suspense>
) : (
<LoadingView />
Expand Down
41 changes: 38 additions & 3 deletions src/ClientContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import { useTranslation } from "react-i18next";
import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync";
import { MatrixError } from "matrix-js-sdk/src/matrix";
import { WidgetApi } from "matrix-widget-api";

import { ErrorView } from "./FullScreenView";
import { fallbackICEServerAllowed, initClient } from "./utils/matrix";
Expand All @@ -36,6 +37,7 @@
import { translatedError } from "./TranslatedError";
import { useEventTarget } from "./useEvents";
import { Config } from "./config/Config";
import { useReactions } from "./useReactions";

declare global {
interface Window {
Expand Down Expand Up @@ -144,6 +146,7 @@
}

export const ClientProvider: FC<Props> = ({ children }) => {
const { setSupportsReactions } = useReactions();

Check warning on line 149 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L149

Added line #L149 was not covered by tests
const history = useHistory();

// null = signed out, undefined = loading
Expand Down Expand Up @@ -188,11 +191,11 @@
saveSession({ ...session, passwordlessUser: false });

setInitClientState({
client: initClientState.client,
...initClientState,

Check warning on line 194 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L194

Added line #L194 was not covered by tests
passwordlessUser: false,
});
},
[initClientState?.client],
[initClientState],

Check warning on line 198 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L198

Added line #L198 was not covered by tests
);

const setClient = useCallback(
Expand All @@ -206,6 +209,7 @@
if (clientParams) {
saveSession(clientParams.session);
setInitClientState({
widgetApi: null,

Check warning on line 212 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L212

Added line #L212 was not covered by tests
client: clientParams.client,
passwordlessUser: clientParams.session.passwordlessUser,
});
Expand Down Expand Up @@ -309,12 +313,40 @@
initClientState.client.on(ClientEvent.Sync, onSync);
}

if (initClientState.widgetApi) {
let supportsReactions = true;

Check warning on line 317 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L316-L317

Added lines #L316 - L317 were not covered by tests

const reactSend = initClientState.widgetApi.hasCapability(
"org.matrix.msc2762.send.event:m.reaction",
);
const redactSend = initClientState.widgetApi.hasCapability(
"org.matrix.msc2762.send.event:m.room.redaction",
);
const reactRcv = initClientState.widgetApi.hasCapability(
"org.matrix.msc2762.receive.event:m.reaction",
);
const redactRcv = initClientState.widgetApi.hasCapability(
"org.matrix.msc2762.receive.event:m.room.redaction",
);

Check warning on line 330 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L319-L330

Added lines #L319 - L330 were not covered by tests

if (!reactSend || !reactRcv || !redactSend || !redactRcv) {
supportsReactions = false;
}

Check warning on line 334 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L332-L334

Added lines #L332 - L334 were not covered by tests

setSupportsReactions(supportsReactions);
if (!supportsReactions) {
logger.warn("Widget does not support reactions");
} else {
logger.warn("Widget does support reactions");
}
}

Check warning on line 342 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L336-L342

Added lines #L336 - L342 were not covered by tests

return (): void => {
if (initClientState.client) {
initClientState.client.removeListener(ClientEvent.Sync, onSync);
}
};
}, [initClientState, onSync]);
}, [initClientState, onSync, setSupportsReactions]);

Check warning on line 349 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L349

Added line #L349 was not covered by tests

if (alreadyOpenedErr) {
return <ErrorView error={alreadyOpenedErr} />;
Expand All @@ -326,6 +358,7 @@
};

type InitResult = {
widgetApi: WidgetApi | null;
client: MatrixClient;
passwordlessUser: boolean;
};
Expand All @@ -336,6 +369,7 @@
logger.log("Using a matryoshka client");
const client = await widget.client;
return {
widgetApi: widget.api,

Check warning on line 372 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L372

Added line #L372 was not covered by tests
client,
passwordlessUser: false,
};
Expand Down Expand Up @@ -364,6 +398,7 @@
try {
const client = await initClient(initClientParams, true);
return {
widgetApi: null,

Check warning on line 401 in src/ClientContext.tsx

View check run for this annotation

Codecov / codecov/patch

src/ClientContext.tsx#L401

Added line #L401 was not covered by tests
client,
passwordlessUser,
};
Expand Down
33 changes: 33 additions & 0 deletions src/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,39 @@
);
};

interface RaiseHandButtonProps extends ComponentPropsWithoutRef<"button"> {
raised: boolean;
}
export const RaiseHandButton: FC<RaiseHandButtonProps> = ({
raised,
...props
}) => {
const { t } = useTranslation();

Check warning on line 101 in src/button/Button.tsx

View check run for this annotation

Codecov / codecov/patch

src/button/Button.tsx#L98-L101

Added lines #L98 - L101 were not covered by tests

return (
<Tooltip label={t("common.raise_hand")}>
<CpdButton
kind={raised ? "primary" : "secondary"}
{...props}
style={{ paddingLeft: 8, paddingRight: 8 }}

Check warning on line 108 in src/button/Button.tsx

View check run for this annotation

Codecov / codecov/patch

src/button/Button.tsx#L103-L108

Added lines #L103 - L108 were not covered by tests
>
<p
role="img"
aria-label="raised hand"
style={{
width: "30px",
height: "0px",
display: "inline-block",
fontSize: "22px",
}}
>

Check warning on line 119 in src/button/Button.tsx

View check run for this annotation

Codecov / codecov/patch

src/button/Button.tsx#L110-L119

Added lines #L110 - L119 were not covered by tests
</p>
</CpdButton>
</Tooltip>

Check warning on line 123 in src/button/Button.tsx

View check run for this annotation

Codecov / codecov/patch

src/button/Button.tsx#L121-L123

Added lines #L121 - L123 were not covered by tests
);
};

Check warning on line 125 in src/button/Button.tsx

View check run for this annotation

Codecov / codecov/patch

src/button/Button.tsx#L125

Added line #L125 was not covered by tests

export const EndCallButton: FC<ComponentPropsWithoutRef<"button">> = ({
className,
...props
Expand Down
Loading