|
|
|
@ -1043,6 +1043,7 @@ export async function handleCallTypeOffer(
|
|
|
|
|
window.log.info('handling callMessage OFFER with uuid: ', remoteCallUUID);
|
|
|
|
|
|
|
|
|
|
if (!getCallMediaPermissionsSettings()) {
|
|
|
|
|
// we still add it to the cache so if user toggles settings in the next 60 sec, he can still reply to it
|
|
|
|
|
const cachedMsg = getCachedMessageFromCallMessage(callMessage, incomingOfferTimestamp);
|
|
|
|
|
pushCallMessageToCallCache(sender, remoteCallUUID, cachedMsg);
|
|
|
|
|
|
|
|
|
@ -1059,6 +1060,12 @@ export async function handleCallTypeOffer(
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if the offer is more than the call timeout, don't try to handle it (as the sender would have already closed it)
|
|
|
|
|
if (incomingOfferTimestamp <= Date.now() - callTimeoutMs) {
|
|
|
|
|
await handleMissedCall(sender, incomingOfferTimestamp, 'too-old-timestamp');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentCallUUID && currentCallUUID !== remoteCallUUID) {
|
|
|
|
|
// we just got a new offer with a different callUUID. this is a missed call (from either the same sender or another one)
|
|
|
|
|
if (callCache.get(sender)?.has(currentCallUUID)) {
|
|
|
|
@ -1124,7 +1131,7 @@ export async function handleCallTypeOffer(
|
|
|
|
|
export async function handleMissedCall(
|
|
|
|
|
sender: string,
|
|
|
|
|
incomingOfferTimestamp: number,
|
|
|
|
|
reason: 'not-approved' | 'permissions' | 'another-call-ongoing'
|
|
|
|
|
reason: 'not-approved' | 'permissions' | 'another-call-ongoing' | 'too-old-timestamp'
|
|
|
|
|
) {
|
|
|
|
|
const incomingCallConversation = getConversationController().get(sender);
|
|
|
|
|
|
|
|
|
@ -1143,6 +1150,9 @@ export async function handleMissedCall(
|
|
|
|
|
case 'not-approved':
|
|
|
|
|
ToastUtils.pushedMissedCallNotApproved(displayname);
|
|
|
|
|
break;
|
|
|
|
|
case 'too-old-timestamp':
|
|
|
|
|
//no toast for this case, the missed call notification is enough
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|