From 9442b314b28951fc2ffd639d9e26f6cb1d302b67 Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Mon, 17 Apr 2023 18:47:46 +0100
Subject: [PATCH] Fix PostHog in embedded mode

Embedded mode has a differtent path to join the call and we missed
changing the groupCall.enter() function for the wrapper that does
analytics.
---
 src/room/GroupCallView.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx
index ad011ef..e5c6a92 100644
--- a/src/room/GroupCallView.tsx
+++ b/src/room/GroupCallView.tsx
@@ -143,7 +143,7 @@ export function GroupCallView({
           groupCall.setLocalVideoMuted(videoInput === null),
         ]);
 
-        await groupCall.enter();
+        await enter();
         PosthogAnalytics.instance.eventCallEnded.cacheStartCall(new Date());
         PosthogAnalytics.instance.eventCallStarted.track(groupCall.groupCallId);
 
@@ -158,17 +158,17 @@ export function GroupCallView({
         widget.lazyActions.off(ElementWidgetActions.JoinCall, onJoin);
       };
     }
-  }, [groupCall, preload, setAudioInput, setVideoInput]);
+  }, [groupCall, preload, setAudioInput, setVideoInput, enter]);
 
   useEffect(() => {
     if (isEmbedded && !preload) {
       // In embedded mode, bypass the lobby and just enter the call straight away
-      groupCall.enter();
+      enter();
 
       PosthogAnalytics.instance.eventCallEnded.cacheStartCall(new Date());
       PosthogAnalytics.instance.eventCallStarted.track(groupCall.groupCallId);
     }
-  }, [groupCall, isEmbedded, preload]);
+  }, [groupCall, isEmbedded, preload, enter]);
 
   useSentryGroupCallHandler(groupCall);