From 5a3c04d630629e4ca02de4ed19e86f7638ca8a6a Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Tue, 16 Aug 2022 16:52:09 -0700 Subject: [PATCH] Additional logging for calling service --- ts/background.ts | 2 +- ts/components/CallManager.tsx | 8 ++++++-- ts/components/CallScreen.tsx | 8 ++++++-- ts/components/CallingPip.tsx | 8 ++++++-- ts/hooks/useKeyboardShortcuts.tsx | 4 ++-- ts/services/calling.ts | 6 +++--- ts/state/ducks/calling.ts | 11 ++++------- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/ts/background.ts b/ts/background.ts index c2f25669f..e229d5933 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -1709,7 +1709,7 @@ export async function startApp(): Promise { }); window.Whisper.events.on('powerMonitorLockScreen', () => { - window.reduxActions.calling.hangUpActiveCall(); + window.reduxActions.calling.hangUpActiveCall('powerMonitorLockScreen'); }); const reconnectToWebSocketQueue = new LatestQueue(); diff --git a/ts/components/CallManager.tsx b/ts/components/CallManager.tsx index c9a35a7d1..0fb37012a 100644 --- a/ts/components/CallManager.tsx +++ b/ts/components/CallManager.tsx @@ -93,7 +93,7 @@ export type PropsType = { stopRingtone: () => unknown; switchToPresentationView: () => void; switchFromPresentationView: () => void; - hangUpActiveCall: () => void; + hangUpActiveCall: (reason: string) => void; theme: ThemeType; togglePip: () => void; toggleScreenRecordingPermissionsDialog: () => unknown; @@ -187,6 +187,10 @@ const ActiveCallManager: React.FC = ({ [setGroupCallVideoRequest, conversation.id] ); + const onSafetyNumberDialogCancel = useCallback(() => { + hangUpActiveCall('safety number dialog cancel'); + }, [hangUpActiveCall]); + let isCallFull: boolean; let showCallLobby: boolean; let groupMembers: @@ -351,7 +355,7 @@ const ActiveCallManager: React.FC = ({ contacts={activeCall.conversationsWithSafetyNumberChanges} getPreferredBadge={getPreferredBadge} i18n={i18n} - onCancel={hangUpActiveCall} + onCancel={onSafetyNumberDialogCancel} onConfirm={() => { keyChangeOk({ conversationId: activeCall.conversation.id }); }} diff --git a/ts/components/CallScreen.tsx b/ts/components/CallScreen.tsx index b9beef6b0..b924be5fd 100644 --- a/ts/components/CallScreen.tsx +++ b/ts/components/CallScreen.tsx @@ -51,7 +51,7 @@ export type PropsType = { getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource; getPresentingSources: () => void; groupMembers?: Array>; - hangUpActiveCall: () => void; + hangUpActiveCall: (reason: string) => void; i18n: LocalizerType; joinedAt?: number; me: ConversationType; @@ -181,6 +181,10 @@ export const CallScreen: React.FC = ({ } }, [getPresentingSources, presentingSource, setPresenting]); + const hangUp = useCallback(() => { + hangUpActiveCall('button click'); + }, [hangUpActiveCall]); + const [controlsHover, setControlsHover] = useState(false); const onControlsMouseEnter = useCallback(() => { @@ -521,7 +525,7 @@ export const CallScreen: React.FC = ({ i18n={i18n} onMouseEnter={onControlsMouseEnter} onMouseLeave={onControlsMouseLeave} - onClick={hangUpActiveCall} + onClick={hangUp} />
diff --git a/ts/components/CallingPip.tsx b/ts/components/CallingPip.tsx index 2588e2205..2a844daec 100644 --- a/ts/components/CallingPip.tsx +++ b/ts/components/CallingPip.tsx @@ -51,7 +51,7 @@ type SnapCandidate = { export type PropsType = { activeCall: ActiveCallType; getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource; - hangUpActiveCall: () => void; + hangUpActiveCall: (reason: string) => void; hasLocalVideo: boolean; i18n: LocalizerType; setGroupCallVideoRequest: (_: Array) => void; @@ -100,6 +100,10 @@ export const CallingPip = ({ setLocalPreview({ element: localVideoRef }); }, [setLocalPreview]); + const hangUp = React.useCallback(() => { + hangUpActiveCall('pip button click'); + }, [hangUpActiveCall]); + const handleMouseMove = React.useCallback( (ev: MouseEvent) => { if (positionState.mode === PositionMode.BeingDragged) { @@ -294,7 +298,7 @@ export const CallingPip = ({