Calls: Fix inconsistent global usage

This commit is contained in:
Alexander Zinchuk 2022-05-16 13:34:03 +02:00
parent 2e156d7ef4
commit 4dfbc58976

View File

@ -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,