allow to hangup even if current call should already be closed

pull/2015/head
Audric Ackermann 4 years ago
parent 27e87edac2
commit 4700a0c832
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -62,7 +62,11 @@ export const IncomingCallDialog = () => {
/>
</IncomingCallAvatatContainer>
<div className="session-modal__button-group">
<SessionButton text={window.i18n('decline')} onClick={handleDeclineIncomingCall} />
<SessionButton
text={window.i18n('decline')}
buttonColor={SessionButtonColor.Danger}
onClick={handleDeclineIncomingCall}
/>
<SessionButton
text={window.i18n('accept')}
onClick={handleAcceptIncomingCall}

@ -592,6 +592,7 @@ function createOrGetPeerConnection(withPubkey: string, createDataChannel: boolea
// tslint:disable-next-line: function-name
export async function USER_acceptIncomingCallRequest(fromSender: string) {
window.log.info('USER_acceptIncomingCallRequest');
if (currentCallUUID) {
window.log.warn(
'Looks like we are already in a call as in USER_acceptIncomingCallRequest is not undefined'
@ -686,22 +687,25 @@ export async function USER_rejectIncomingCallRequest(fromSender: string) {
// tslint:disable-next-line: function-name
export async function USER_hangup(fromSender: string) {
window.log.info('USER_hangup');
if (!currentCallUUID) {
window.log.warn('cannot hangup without a currentCallUUID');
window.log.warn('should not be able to hangup without a currentCallUUID');
return;
} else {
const endCallMessage = new CallMessage({
type: SignalService.CallMessage.Type.END_CALL,
timestamp: Date.now(),
uuid: currentCallUUID,
});
await getMessageQueue().sendToPubKeyNonDurably(PubKey.cast(fromSender), endCallMessage);
}
const endCallMessage = new CallMessage({
type: SignalService.CallMessage.Type.END_CALL,
timestamp: Date.now(),
uuid: currentCallUUID,
});
window.inboxStore?.dispatch(endCall({ pubkey: fromSender }));
window.log.info('sending hangup with an END_CALL MESSAGE');
sendHangupViaDataChannel();
await getMessageQueue().sendToPubKeyNonDurably(PubKey.cast(fromSender), endCallMessage);
clearCallCacheFromPubkey(fromSender);
const convos = getConversationController().getConversations();

Loading…
Cancel
Save