mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
Merge pull request #305 from SableClient/fix/call-camera-default
fix(call): respect saved camera/mic preferences when starting call from room header
This commit is contained in:
2 files changed
+8
-1
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: patch
|
||||
---
|
||||
|
||||
Fix camera turning on by default when starting a call from the room header button
|
||||
@@ -4,6 +4,7 @@ import { Room } from '$types/matrix-sdk';
|
||||
import { useCallStart, useCallJoined } from '$hooks/useCallEmbed';
|
||||
import { callEmbedAtom } from '$state/callEmbed';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useCallPreferences } from '$state/hooks/callPreferences';
|
||||
|
||||
interface RoomCallButtonProps {
|
||||
room: Room;
|
||||
@@ -14,13 +15,14 @@ export function RoomCallButton({ room }: RoomCallButtonProps) {
|
||||
const callEmbed = useAtomValue(callEmbedAtom);
|
||||
const joined = useCallJoined(callEmbed);
|
||||
const mx = useMatrixClient();
|
||||
const { microphone, video, sound } = useCallPreferences();
|
||||
|
||||
const isJoinedInThisRoom = joined && callEmbed?.roomId === room.roomId;
|
||||
|
||||
if (isJoinedInThisRoom) return null;
|
||||
|
||||
const handleStartCall = async () => {
|
||||
startCall(room);
|
||||
startCall(room, { microphone, video, sound });
|
||||
try {
|
||||
const now = Date.now();
|
||||
// TODO not use as any one day someday i swear
|
||||
|
||||
Reference in new issue
Block a user