Track acceptedTime during call, fix call screen duration

This commit is contained in:
Jamie Kyle 2023-09-20 07:00:01 -07:00 committed by GitHub
parent 95b0f67a47
commit bc67d421ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 92 additions and 64 deletions

View file

@ -121,7 +121,7 @@ export type ActiveCallStateType = {
hasLocalVideo: boolean;
localAudioLevel: number;
viewMode: CallViewMode;
joinedAt?: number;
joinedAt: number | null;
outgoingRing: boolean;
pip: boolean;
presentingSource?: PresentedSource;
@ -150,7 +150,7 @@ export type AcceptCallType = ReadonlyDeep<{
export type CallStateChangeType = ReadonlyDeep<{
conversationId: string;
acceptedTime?: number;
acceptedTime: number | null;
callState: CallState;
callEndedReason?: CallEndedReason;
}>;
@ -1647,6 +1647,7 @@ export function reducer(
settingsDialogOpen: false,
showParticipantsList: false,
outgoingRing,
joinedAt: null,
},
};
}
@ -1675,6 +1676,7 @@ export function reducer(
settingsDialogOpen: false,
showParticipantsList: false,
outgoingRing: true,
joinedAt: null,
},
};
}
@ -1698,6 +1700,7 @@ export function reducer(
settingsDialogOpen: false,
showParticipantsList: false,
outgoingRing: false,
joinedAt: null,
},
};
}
@ -1852,6 +1855,7 @@ export function reducer(
settingsDialogOpen: false,
showParticipantsList: false,
outgoingRing: true,
joinedAt: null,
},
};
}
@ -1882,7 +1886,7 @@ export function reducer(
) {
activeCallState = {
...state.activeCallState,
joinedAt: action.payload.acceptedTime,
joinedAt: action.payload.acceptedTime ?? null,
};
} else {
({ activeCallState } = state);

View file

@ -14,7 +14,10 @@ import type { ConversationType } from '../ducks/conversations';
import { getIncomingCall } from '../selectors/calling';
import { isGroupCallOutboundRingEnabled } from '../../util/isGroupCallOutboundRingEnabled';
import type {
ActiveCallBaseType,
ActiveCallType,
ActiveDirectCallType,
ActiveGroupCallType,
GroupCallRemoteParticipantType,
} from '../../types/Calling';
import { isAciString } from '../../util/isAciString';
@ -138,7 +141,7 @@ const mapStateToActiveCallProp = (
return convoForAci ? conversationSelector(convoForAci.id) : undefined;
});
const baseResult = {
const baseResult: ActiveCallBaseType = {
conversation,
hasLocalAudio: activeCallState.hasLocalAudio,
hasLocalVideo: activeCallState.hasLocalVideo,
@ -185,7 +188,7 @@ const mapStateToActiveCallProp = (
serviceId: conversation.serviceId,
},
],
};
} satisfies ActiveDirectCallType;
case CallMode.Group: {
const conversationsWithSafetyNumberChanges: Array<ConversationType> = [];
const groupMembers: Array<ConversationType> = [];
@ -282,7 +285,7 @@ const mapStateToActiveCallProp = (
peekedParticipants,
remoteParticipants,
remoteAudioLevels: call.remoteAudioLevels || new Map<number, number>(),
};
} satisfies ActiveGroupCallType;
}
default:
throw missingCaseError(call);