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.Whisper.events.on('powerMonitorLockScreen', () => {
window.reduxActions.calling.hangUpActiveCall(); window.reduxActions.calling.hangUpActiveCall('powerMonitorLockScreen');
}); });
const reconnectToWebSocketQueue = new LatestQueue(); const reconnectToWebSocketQueue = new LatestQueue();

View File

@ -93,7 +93,7 @@ export type PropsType = {
stopRingtone: () => unknown; stopRingtone: () => unknown;
switchToPresentationView: () => void; switchToPresentationView: () => void;
switchFromPresentationView: () => void; switchFromPresentationView: () => void;
hangUpActiveCall: () => void; hangUpActiveCall: (reason: string) => void;
theme: ThemeType; theme: ThemeType;
togglePip: () => void; togglePip: () => void;
toggleScreenRecordingPermissionsDialog: () => unknown; toggleScreenRecordingPermissionsDialog: () => unknown;
@ -187,6 +187,10 @@ const ActiveCallManager: React.FC<ActiveCallManagerPropsType> = ({
[setGroupCallVideoRequest, conversation.id] [setGroupCallVideoRequest, conversation.id]
); );
const onSafetyNumberDialogCancel = useCallback(() => {
hangUpActiveCall('safety number dialog cancel');
}, [hangUpActiveCall]);
let isCallFull: boolean; let isCallFull: boolean;
let showCallLobby: boolean; let showCallLobby: boolean;
let groupMembers: let groupMembers:
@ -351,7 +355,7 @@ const ActiveCallManager: React.FC<ActiveCallManagerPropsType> = ({
contacts={activeCall.conversationsWithSafetyNumberChanges} contacts={activeCall.conversationsWithSafetyNumberChanges}
getPreferredBadge={getPreferredBadge} getPreferredBadge={getPreferredBadge}
i18n={i18n} i18n={i18n}
onCancel={hangUpActiveCall} onCancel={onSafetyNumberDialogCancel}
onConfirm={() => { onConfirm={() => {
keyChangeOk({ conversationId: activeCall.conversation.id }); keyChangeOk({ conversationId: activeCall.conversation.id });
}} }}

View File

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

View File

@ -51,7 +51,7 @@ type SnapCandidate = {
export type PropsType = { export type PropsType = {
activeCall: ActiveCallType; activeCall: ActiveCallType;
getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource; getGroupCallVideoFrameSource: (demuxId: number) => VideoFrameSource;
hangUpActiveCall: () => void; hangUpActiveCall: (reason: string) => void;
hasLocalVideo: boolean; hasLocalVideo: boolean;
i18n: LocalizerType; i18n: LocalizerType;
setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void; setGroupCallVideoRequest: (_: Array<GroupCallVideoRequest>) => void;
@ -100,6 +100,10 @@ export const CallingPip = ({
setLocalPreview({ element: localVideoRef }); setLocalPreview({ element: localVideoRef });
}, [setLocalPreview]); }, [setLocalPreview]);
const hangUp = React.useCallback(() => {
hangUpActiveCall('pip button click');
}, [hangUpActiveCall]);
const handleMouseMove = React.useCallback( const handleMouseMove = React.useCallback(
(ev: MouseEvent) => { (ev: MouseEvent) => {
if (positionState.mode === PositionMode.BeingDragged) { if (positionState.mode === PositionMode.BeingDragged) {
@ -294,7 +298,7 @@ export const CallingPip = ({
<button <button
aria-label={i18n('calling__hangup')} aria-label={i18n('calling__hangup')}
className="module-calling-pip__button--hangup" className="module-calling-pip__button--hangup"
onClick={hangUpActiveCall} onClick={hangUp}
type="button" type="button"
/> />
<button <button

View File

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

View File

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

View File

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