Calls Tab & Group Call Disposition

This commit is contained in:
Jamie Kyle 2023-08-08 17:53:06 -07:00 committed by GitHub
parent 620e85ca01
commit 1eaabb6734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
139 changed files with 9182 additions and 2721 deletions

View file

@ -3,47 +3,24 @@
import type { CallEventSyncEvent } from '../textsecure/messageReceiverEvents';
import * as log from '../logging/log';
import { CallMode } from '../types/Calling';
import { updateCallHistoryFromRemoteEvent } from './callDisposition';
export async function onCallEventSync(
syncEvent: CallEventSyncEvent
): Promise<void> {
const { callEvent, confirm } = syncEvent;
const {
peerUuid,
callId,
wasIncoming,
wasVideoCall,
wasDeclined,
acceptedTime,
endedTime,
receivedAtCounter,
} = callEvent;
const { callEventDetails, receivedAtCounter } = callEvent;
const { peerId } = callEventDetails;
const conversation = window.ConversationController.get(peerUuid);
const conversation = window.ConversationController.get(peerId);
if (!conversation) {
log.warn(`onCallEventSync: No conversation found for peerUuid ${peerUuid}`);
log.warn(
`onCallEventSync: No conversation found for conversationId ${peerId}`
);
return;
}
log.info(
`onCallEventSync: Queuing job to add call history (Call ID: ${callId})`
);
await conversation.queueJob('onCallEventSync', async () => {
await conversation.addCallHistory(
{
callId,
callMode: CallMode.Direct,
wasDeclined,
wasIncoming,
wasVideoCall,
acceptedTime: acceptedTime ?? undefined,
endedTime: endedTime ?? undefined,
},
receivedAtCounter
);
confirm();
});
await updateCallHistoryFromRemoteEvent(callEventDetails, receivedAtCounter);
confirm();
}