Hang up call when screen is locked
This commit is contained in:
parent
884bfc0594
commit
44bfb77635
4 changed files with 37 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 = () => {
|
||||
|
|
|
@ -22,5 +22,8 @@ export class PowerChannel {
|
|||
powerMonitor.on('resume', () => {
|
||||
send('power-channel:resume');
|
||||
});
|
||||
powerMonitor.on('lock-screen', () => {
|
||||
send('power-channel:lock-screen');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue