Use missingCaseError in <CallingPipRemoteVideo>

This commit is contained in:
Evan Hahn 2021-03-03 11:23:00 -06:00 committed by Josh Perez
parent 8c951602b7
commit 99bcad0bd9

View file

@ -18,6 +18,7 @@ import {
import { SetRendererCanvasType } from '../state/ducks/calling'; import { SetRendererCanvasType } from '../state/ducks/calling';
import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer'; import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer';
import { usePageVisibility } from '../util/hooks'; import { usePageVisibility } from '../util/hooks';
import { missingCaseError } from '../util/missingCaseError';
import { nonRenderedRemoteParticipant } from '../util/ringrtc/nonRenderedRemoteParticipant'; import { nonRenderedRemoteParticipant } from '../util/ringrtc/nonRenderedRemoteParticipant';
// This value should be kept in sync with the hard-coded CSS height. // This value should be kept in sync with the hard-coded CSS height.
@ -131,13 +132,12 @@ export const CallingPipRemoteVideo = ({
setGroupCallVideoRequest, setGroupCallVideoRequest,
]); ]);
if (activeCall.callMode === CallMode.Direct) { switch (activeCall.callMode) {
case CallMode.Direct: {
const { hasRemoteVideo } = activeCall.remoteParticipants[0]; const { hasRemoteVideo } = activeCall.remoteParticipants[0];
if (!hasRemoteVideo) { if (!hasRemoteVideo) {
return <NoVideo activeCall={activeCall} i18n={i18n} />; return <NoVideo activeCall={activeCall} i18n={i18n} />;
} }
return ( return (
<div className="module-calling-pip__video--remote"> <div className="module-calling-pip__video--remote">
<DirectCallRemoteParticipant <DirectCallRemoteParticipant
@ -149,12 +149,10 @@ export const CallingPipRemoteVideo = ({
</div> </div>
); );
} }
case CallMode.Group:
if (activeCall.callMode === CallMode.Group) {
if (!activeGroupCallSpeaker) { if (!activeGroupCallSpeaker) {
return <NoVideo activeCall={activeCall} i18n={i18n} />; return <NoVideo activeCall={activeCall} i18n={i18n} />;
} }
return ( return (
<div className="module-calling-pip__video--remote"> <div className="module-calling-pip__video--remote">
<GroupCallRemoteParticipant <GroupCallRemoteParticipant
@ -166,7 +164,7 @@ export const CallingPipRemoteVideo = ({
/> />
</div> </div>
); );
default:
throw missingCaseError(activeCall);
} }
throw new Error('CallingRemoteVideo: Unknown Call Mode');
}; };