mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-10 21:55:19 +00:00
add allowJoinUnmutedViaIntent to the bridge
This allows us to control to never start unmuted in spa but be able to start unmuted in widget and component mode.
This commit is contained in:
@@ -54,6 +54,21 @@ describe("useComponentHostBridge", () => {
|
||||
}),
|
||||
).resolves.toBeUndefined();
|
||||
expect(result.current.supportsReactions).toBe(true);
|
||||
// Starting the user unmuted unasked is something a host has to opt into
|
||||
expect(result.current.allowJoinUnmutedViaIntent).toBe(false);
|
||||
});
|
||||
|
||||
test("lets the host allow joining unmuted on the intent", () => {
|
||||
const { result, rerender } = renderHook(
|
||||
({ supplied }: { supplied: ElementCallHostBridge }) =>
|
||||
useComponentHostBridge(supplied, undefined, undefined),
|
||||
{ initialProps: { supplied: {} } },
|
||||
);
|
||||
expect(result.current.allowJoinUnmutedViaIntent).toBe(false);
|
||||
|
||||
// Read through to whatever the host most recently said
|
||||
rerender({ supplied: { allowJoinUnmutedViaIntent: true } });
|
||||
expect(result.current.allowJoinUnmutedViaIntent).toBe(true);
|
||||
});
|
||||
|
||||
test("only has a close when the host has one, since that is a signal", () => {
|
||||
|
||||
@@ -64,6 +64,14 @@ export interface ElementCallHostBridge {
|
||||
* Defaults to true.
|
||||
*/
|
||||
readonly supportsReactions?: boolean;
|
||||
/**
|
||||
* Whether the user may start unmuted when the intent skips the lobby, so
|
||||
* that they never see their devices before joining. Defaults to false: the
|
||||
* user starts muted and unmutes themselves. A host that chose the intent on
|
||||
* the user's behalf, and is sure they expect to be heard and seen at once,
|
||||
* says so here — as a Matrix client hosting Element Call as a widget does.
|
||||
*/
|
||||
readonly allowJoinUnmutedViaIntent?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,6 +172,9 @@ export function useComponentHostBridge(
|
||||
get supportsReactions(): boolean {
|
||||
return latest.current.supportsReactions ?? true;
|
||||
},
|
||||
get allowJoinUnmutedViaIntent(): boolean {
|
||||
return latest.current.allowJoinUnmutedViaIntent ?? false;
|
||||
},
|
||||
// Whatever the host says or does not say, the account is its own: it
|
||||
// signed the user in and handed us the client. So Element Call never
|
||||
// offers to edit the profile from inside a component.
|
||||
|
||||
Reference in New Issue
Block a user