Hang up call when screen is locked

This commit is contained in:
Josh Perez 2022-01-24 15:32:09 -05:00 committed by GitHub
parent 884bfc0594
commit 44bfb77635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 0 deletions

View File

@ -226,6 +226,10 @@ try {
Whisper.events.trigger('powerMonitorResume');
});
ipc.on('power-channel:lock-screen', () => {
Whisper.events.trigger('powerMonitorLockScreen');
});
window.sendChallengeRequest = request =>
ipc.send('challenge:request', request);

View File

@ -1579,6 +1579,10 @@ export async function startApp(): Promise<void> {
server?.checkSockets();
});
window.Whisper.events.on('powerMonitorLockScreen', () => {
window.reduxActions.calling.hangUpActiveCall();
});
const reconnectToWebSocketQueue = new LatestQueue();
const enqueueReconnectToWebSocket = () => {

View File

@ -22,5 +22,8 @@ export class PowerChannel {
powerMonitor.on('resume', () => {
send('power-channel:resume');
});
powerMonitor.on('lock-screen', () => {
send('power-channel:lock-screen');
});
}
}

View File

@ -751,6 +751,31 @@ function hangUp(payload: HangUpType): HangUpActionType {
};
}
function hangUpActiveCall(): ThunkAction<
void,
RootStateType,
unknown,
HangUpActionType
> {
return (dispatch, getState) => {
const state = getState();
const activeCall = getActiveCall(state.calling);
if (!activeCall) {
return;
}
const { conversationId } = activeCall;
dispatch({
type: HANG_UP,
payload: {
conversationId,
},
});
};
}
function keyChanged(
payload: KeyChangedType
): ThunkAction<void, RootStateType, unknown, KeyChangedActionType> {
@ -1219,6 +1244,7 @@ export const actions = {
getPresentingSources,
groupCallStateChange,
hangUp,
hangUpActiveCall,
keyChangeOk,
keyChanged,
openSystemPreferencesAction,