From d53167d73451fc51659d66ca5530b4ecbe873e3a Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Tue, 6 Jun 2023 08:14:02 +0800 Subject: [PATCH] refactor: in iframe --- src/routes/chat/VoiceChat/index.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/routes/chat/VoiceChat/index.tsx b/src/routes/chat/VoiceChat/index.tsx index 49ef741c..685ec08d 100644 --- a/src/routes/chat/VoiceChat/index.tsx +++ b/src/routes/chat/VoiceChat/index.tsx @@ -19,7 +19,7 @@ type Props = { context?: ChatContext; id: number; }; - +const isIframe = isInIframe(); const VoiceChat = ({ id, context = "channel" }: Props) => { const { joinVoice, joined, joining = false, joinedAtThisContext } = useVoice({ id, context }); const dispatch = useDispatch(); @@ -45,10 +45,6 @@ const VoiceChat = ({ id, context = "channel" }: Props) => { alert("You have joined another channel, please leave first!"); return; } - if (isInIframe()) { - toast.error("Voice is not supported in iframe"); - return; - } joinVoice(); const data = { id, @@ -60,6 +56,10 @@ const VoiceChat = ({ id, context = "channel" }: Props) => { dispatch(updateCallInfo({ from: loginUser?.uid ?? 0, to: id, calling: false })); } }; + const handleInIframe = () => { + // todo + toast.error("Voice is not supported in iframe"); + }; if (!loginUser || !enabled) return null; const visible = visibleAside == "voice"; const memberCount = voiceList.find((v) => v.context == context && v.id == id)?.memberCount ?? 0; @@ -70,7 +70,7 @@ const VoiceChat = ({ id, context = "channel" }: Props) => { {visible ? null : ( <>