Fix race condition which often prevented sending group call started message

The group call update message after starting a group call is currently only
sent in the onLocalDeviceStateChanged callback. But often the peekInfo is
not available yet when the connection state changes to Joined, effectively
preventing the group call update message to be sent.

This commit also sends the message in the onPeekChanged callback. It is still
only sent at most once, which is ensured by the updateMessageState check.

See [#5001][0].

[0]: https://github.com/signalapp/Signal-Desktop/pull/5001
This commit is contained in:
AsamK 2021-04-02 22:32:04 +02:00 committed by GitHub
parent 30e8feed8b
commit ea7a5449f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -478,6 +478,18 @@ export class CallingClass {
this.syncGroupCallToRedux(conversationId, groupCall);
},
onPeekChanged: groupCall => {
const localDeviceState = groupCall.getLocalDeviceState();
const { eraId } = groupCall.getPeekInfo() || {};
if (
updateMessageState === GroupCallUpdateMessageState.SentNothing &&
localDeviceState.connectionState !== ConnectionState.NotConnected &&
localDeviceState.joinState === JoinState.Joined &&
eraId
) {
updateMessageState = GroupCallUpdateMessageState.SentJoin;
this.sendGroupCallUpdateMessage(conversationId, eraId);
}
this.updateCallHistoryForGroupCall(
conversationId,
groupCall.getPeekInfo()