From 4dfbc5897666f0d33840a8519c7a2ce49ae0f4b8 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 16 May 2022 13:34:03 +0200 Subject: [PATCH] Calls: Fix inconsistent global usage --- src/global/actions/apiUpdaters/calls.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/global/actions/apiUpdaters/calls.ts b/src/global/actions/apiUpdaters/calls.ts index 8de1b42ae..4e0b23dcc 100644 --- a/src/global/actions/apiUpdaters/calls.ts +++ b/src/global/actions/apiUpdaters/calls.ts @@ -7,6 +7,7 @@ import { ARE_CALLS_SUPPORTED } from '../../../util/environment'; import { notifyAboutCall } from '../../../util/notifications'; import { selectPhoneCallUser } from '../../selectors/calls'; import { initializeSoundsForSafari } from '../ui/calls'; +import { onTickEnd } from '../../../util/schedulers'; addActionHandler('apiUpdate', (global, actions, update) => { switch (update['@type']) { @@ -20,11 +21,13 @@ addActionHandler('apiUpdate', (global, actions, update) => { } } - return updateGroupCall(global, + return updateGroupCall( + global, update.call.id, omit(update.call, ['connectionState']), undefined, - update.call.participantsCount); + update.call.participantsCount, + ); } case 'updateGroupCallChatId': { const chat = selectChat(global, update.chatId); @@ -72,10 +75,13 @@ addActionHandler('apiUpdate', (global, actions, update) => { const isOutgoing = call?.adminId === currentUserId; if (!isOutgoing && call.state === 'requested') { - notifyAboutCall({ - call, - user: selectPhoneCallUser(global)!, + onTickEnd(() => { + notifyAboutCall({ + call, + user: selectPhoneCallUser(global)!, + }); }); + void initializeSoundsForSafari(); return { ...global,