Poll for devices when joining a group call

This commit is contained in:
Evan Hahn 2021-09-28 11:35:40 -05:00 committed by GitHub
parent 377cdb3281
commit ed222fee9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 17 deletions

View file

@ -672,12 +672,12 @@ export class CallingClass {
return outerGroupCall; return outerGroupCall;
} }
public joinGroupCall( public async joinGroupCall(
conversationId: string, conversationId: string,
hasLocalAudio: boolean, hasLocalAudio: boolean,
hasLocalVideo: boolean, hasLocalVideo: boolean,
shouldRing: boolean shouldRing: boolean
): void { ): Promise<void> {
const conversation = window.ConversationController.get( const conversation = window.ConversationController.get(
conversationId conversationId
)?.format(); )?.format();
@ -697,6 +697,8 @@ export class CallingClass {
return; return;
} }
await this.startDeviceReselectionTimer();
const groupCall = this.connectGroupCall(conversationId, { const groupCall = this.connectGroupCall(conversationId, {
groupId: conversation.groupId, groupId: conversation.groupId,
publicParams: conversation.publicParams, publicParams: conversation.publicParams,

View file

@ -538,7 +538,7 @@ function acceptCall(
await calling.acceptDirectCall(conversationId, asVideoCall); await calling.acceptDirectCall(conversationId, asVideoCall);
break; break;
case CallMode.Group: case CallMode.Group:
calling.joinGroupCall(conversationId, true, asVideoCall, false); await calling.joinGroupCall(conversationId, true, asVideoCall, false);
break; break;
default: default:
throw missingCaseError(call); throw missingCaseError(call);
@ -1104,7 +1104,7 @@ function showCallLobby(payload: ShowCallLobbyType): CallLobbyActionType {
function startCall( function startCall(
payload: StartCallType payload: StartCallType
): ThunkAction<void, RootStateType, unknown, StartDirectCallActionType> { ): ThunkAction<void, RootStateType, unknown, StartDirectCallActionType> {
return (dispatch, getState) => { return async (dispatch, getState) => {
switch (payload.callMode) { switch (payload.callMode) {
case CallMode.Direct: case CallMode.Direct:
calling.startOutgoingDirectCall( calling.startOutgoingDirectCall(
@ -1134,7 +1134,7 @@ function startCall(
outgoingRing = false; outgoingRing = false;
} }
calling.joinGroupCall( await calling.joinGroupCall(
payload.conversationId, payload.conversationId,
payload.hasLocalAudio, payload.hasLocalAudio,
payload.hasLocalVideo, payload.hasLocalVideo,

View file

@ -336,10 +336,9 @@ describe('calling duck', () => {
this.callingServiceAccept = this.sandbox this.callingServiceAccept = this.sandbox
.stub(callingService, 'acceptDirectCall') .stub(callingService, 'acceptDirectCall')
.resolves(); .resolves();
this.callingServiceJoin = this.sandbox.stub( this.callingServiceJoin = this.sandbox
callingService, .stub(callingService, 'joinGroupCall')
'joinGroupCall' .resolves();
);
}); });
describe('accepting a direct call', () => { describe('accepting a direct call', () => {
@ -1858,15 +1857,14 @@ describe('calling duck', () => {
callingService, callingService,
'startOutgoingDirectCall' 'startOutgoingDirectCall'
); );
this.callingJoinGroupCall = this.sandbox.stub( this.callingJoinGroupCall = this.sandbox
callingService, .stub(callingService, 'joinGroupCall')
'joinGroupCall' .resolves();
);
}); });
it('asks the calling service to start an outgoing direct call', function test() { it('asks the calling service to start an outgoing direct call', async function test() {
const dispatch = sinon.spy(); const dispatch = sinon.spy();
startCall({ await startCall({
callMode: CallMode.Direct, callMode: CallMode.Direct,
conversationId: '123', conversationId: '123',
hasLocalAudio: true, hasLocalAudio: true,
@ -1884,9 +1882,9 @@ describe('calling duck', () => {
sinon.assert.notCalled(this.callingJoinGroupCall); sinon.assert.notCalled(this.callingJoinGroupCall);
}); });
it('asks the calling service to join a group call', function test() { it('asks the calling service to join a group call', async function test() {
const dispatch = sinon.spy(); const dispatch = sinon.spy();
startCall({ await startCall({
callMode: CallMode.Group, callMode: CallMode.Group,
conversationId: '123', conversationId: '123',
hasLocalAudio: true, hasLocalAudio: true,