From dc9caa0a99416a2c580dd68f2f625cd1f4ad5e36 Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Mon, 28 Aug 2023 09:30:47 -0700 Subject: [PATCH] Add logs to group call peeks after call ended --- ts/background.ts | 8 ++++++++ ts/state/ducks/calling.ts | 29 +++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/ts/background.ts b/ts/background.ts index a951344d3..ddbc0bafc 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -190,6 +190,7 @@ import { getCallsHistoryForRedux, loadCallsHistory, } from './services/callHistoryLoader'; +import { getCallIdFromEra } from './util/callDisposition'; export function isOverHourIntoPast(timestamp: number): boolean { return isNumber(timestamp) && isOlderThan(timestamp, HOUR); @@ -2913,6 +2914,13 @@ export async function startApp(): Promise { ): boolean { if (message.groupCallUpdate) { if (message.groupV2 && messageDescriptor.type === Message.GROUP) { + log.info( + 'handleGroupCallUpdateMessage', + message.timestamp, + message.groupCallUpdate?.eraId != null + ? getCallIdFromEra(message.groupCallUpdate.eraId) + : null + ); window.reduxActions.calling.peekNotConnectedGroupCall({ conversationId: messageDescriptor.id, }); diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts index edaf6190e..5789e4d6d 100644 --- a/ts/state/ducks/calling.ts +++ b/ts/state/ducks/calling.ts @@ -345,9 +345,13 @@ const doGroupCallPeek = ( conversationId ); if ( - existingCall?.callMode === CallMode.Group && + existingCall != null && + existingCall.callMode === CallMode.Group && existingCall.connectionState !== GroupCallConnectionState.NotConnected ) { + log.info( + `doGroupCallPeek/groupv2: Not peeking because the connection state is ${existingCall.connectionState}` + ); return; } @@ -375,11 +379,18 @@ const doGroupCallPeek = ( const joinState = existingCall?.callMode === CallMode.Group ? existingCall.joinState : null; - await calling.updateCallHistoryForGroupCall( - conversationId, - joinState, - peekInfo - ); + try { + await calling.updateCallHistoryForGroupCall( + conversationId, + joinState, + peekInfo + ); + } catch (error) { + log.error( + 'doGroupCallPeek/groupv2: Failed to update call history', + Errors.toLogFormat(error) + ); + } const formattedPeekInfo = calling.formatGroupCallPeekInfoForRedux(peekInfo); @@ -874,6 +885,12 @@ function groupCallStateChange( const { ourAci } = getState().user; strictAssert(ourAci, 'groupCallStateChange failed to fetch our ACI'); + log.info( + 'groupCallStateChange:', + payload.conversationId, + GroupCallConnectionState[payload.connectionState], + GroupCallJoinState[payload.joinState] + ); dispatch({ type: GROUP_CALL_STATE_CHANGE, payload: {