Don't show group call start notifications more than once

This commit is contained in:
Evan Hahn 2021-10-05 16:11:40 -05:00 committed by GitHub
parent d479427d88
commit 3c91dce993
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 44 deletions

View file

@ -859,7 +859,6 @@ function peekNotConnectedGroupCall(
queue.add(async () => {
const state = getState();
const { ourUuid } = state.user;
// We make sure we're not trying to peek at a connected (or connecting, or
// reconnecting) call. Because this is asynchronous, it's possible that the call
@ -893,7 +892,7 @@ function peekNotConnectedGroupCall(
return;
}
calling.updateCallHistoryForGroupCall(conversationId, peekInfo);
await calling.updateCallHistoryForGroupCall(conversationId, peekInfo);
const formattedPeekInfo = calling.formatGroupCallPeekInfoForRedux(
peekInfo
@ -907,22 +906,6 @@ function peekNotConnectedGroupCall(
ourConversationId: state.user.ourConversationId,
},
});
// We want to show "Alice started a group call" only if a call isn't ringing or
// active. We wait a moment to make sure that we don't accidentally show a ring
// notification followed swiftly by a less urgent notification.
if (!isAnybodyElseInGroupCall(formattedPeekInfo, ourUuid)) {
return;
}
await sleep(1000);
const newCallingState = getState().calling;
if (
getActiveCall(newCallingState)?.conversationId === conversationId ||
getIncomingCall(newCallingState.callsByConversation, ourUuid)
) {
return;
}
calling.notifyForGroupCall(conversationId, peekInfo.creator);
});
};
}