Additional logging for calling service

This commit is contained in:
Fedor Indutny 2022-08-16 16:52:09 -07:00 committed by GitHub
parent 932043c58f
commit 5a3c04d630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 19 deletions

View File

@ -1709,7 +1709,7 @@ export async function startApp(): Promise<void> {
});
window.Whisper.events.on('powerMonitorLockScreen', () => {
window.reduxActions.calling.hangUpActiveCall();
window.reduxActions.calling.hangUpActiveCall('powerMonitorLockScreen');
});
const reconnectToWebSocketQueue = new LatestQueue();

View File

@ -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<ActiveCallManagerPropsType> = ({
[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<ActiveCallManagerPropsType> = ({
contacts={activeCall.conversationsWithSafetyNumberChanges}
getPreferredBadge={getPreferredBadge}
i18n={i18n}
onCancel={hangUpActiveCall}
onCancel={onSafetyNumberDialogCancel}
onConfirm={() => {
keyChangeOk({ conversationId: activeCall.conversation.id });
}}

View File

@ -51,7 +51,7 @@ export type PropsType = {
getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource;
getPresentingSources: () => void;
groupMembers?: Array<Pick<ConversationType, 'id' | 'firstName' | 'title'>>;
hangUpActiveCall: () => void;
hangUpActiveCall: (reason: string) => void;
i18n: LocalizerType;
joinedAt?: number;
me: ConversationType;
@ -181,6 +181,10 @@ export const CallScreen: React.FC<PropsType> = ({
}
}, [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<PropsType> = ({
i18n={i18n}
onMouseEnter={onControlsMouseEnter}
onMouseLeave={onControlsMouseLeave}
onClick={hangUpActiveCall}
onClick={hangUp}
/>
</div>
<div className="module-ongoing-call__footer__local-preview">

View File

@ -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<GroupCallVideoRequest>) => 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 = ({
<button
aria-label={i18n('calling__hangup')}
className="module-calling-pip__button--hangup"
onClick={hangUpActiveCall}
onClick={hangUp}
type="button"
/>
<button

View File

@ -23,7 +23,7 @@ function isCtrlOrAlt(ev: KeyboardEvent): boolean {
}
export function useActiveCallShortcuts(
hangUp: () => unknown
hangUp: (reason: string) => unknown
): KeyboardShortcutHandlerType {
return useCallback(
ev => {
@ -34,7 +34,7 @@ export function useActiveCallShortcuts(
ev.preventDefault();
ev.stopPropagation();
hangUp();
hangUp('Keyboard shortcut');
return true;
}

View File

@ -292,7 +292,7 @@ export class CallingClass {
ipcRenderer.on('quit', () => {
for (const conversationId of Object.keys(this.callsByConversation)) {
this.hangup(conversationId);
this.hangup(conversationId, 'ipcRenderer quit');
}
});
@ -1067,8 +1067,8 @@ export class CallingClass {
);
}
hangup(conversationId: string): void {
log.info('CallingClass.hangup()');
hangup(conversationId: string, reason: string): void {
log.info(`CallingClass.hangup(${conversationId}): ${reason}`);
const specificCall = getOwn(this.callsByConversation, conversationId);
if (!specificCall) {

View File

@ -873,12 +873,9 @@ function groupCallStateChange(
};
}
function hangUpActiveCall(): ThunkAction<
void,
RootStateType,
unknown,
HangUpActionType
> {
function hangUpActiveCall(
reason: string
): ThunkAction<void, RootStateType, unknown, HangUpActionType> {
return async (dispatch, getState) => {
const state = getState();
@ -889,7 +886,7 @@ function hangUpActiveCall(): ThunkAction<
const { conversationId } = activeCall;
calling.hangup(conversationId);
calling.hangup(conversationId, reason);
dispatch({
type: HANG_UP,