Calls: Remove legacy action (#5971)
This commit is contained in:
parent
f6aba87097
commit
d7ea4a5748
@ -1,6 +1,6 @@
|
||||
import type { FC } from '../../../lib/teact/teact';
|
||||
import React, {
|
||||
memo, useCallback, useEffect, useMemo,
|
||||
memo, useCallback, useMemo,
|
||||
} from '../../../lib/teact/teact';
|
||||
import { getActions, getGlobal, withGlobal } from '../../../global';
|
||||
|
||||
@ -41,7 +41,6 @@ const GroupCallTopPane: FC<OwnProps & StateProps> = ({
|
||||
}) => {
|
||||
const {
|
||||
requestMasterAndJoinGroupCall,
|
||||
subscribeToGroupCallUpdates,
|
||||
} = getActions();
|
||||
|
||||
const lang = useOldLang();
|
||||
@ -69,23 +68,6 @@ const GroupCallTopPane: FC<OwnProps & StateProps> = ({
|
||||
.filter(Boolean);
|
||||
}, [participants]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!groupCall?.id) return undefined;
|
||||
if (!isActive && groupCall.isLoaded) return undefined;
|
||||
|
||||
subscribeToGroupCallUpdates({
|
||||
id: groupCall.id,
|
||||
subscribed: true,
|
||||
});
|
||||
|
||||
return () => {
|
||||
subscribeToGroupCallUpdates({
|
||||
id: groupCall.id,
|
||||
subscribed: false,
|
||||
});
|
||||
};
|
||||
}, [groupCall?.id, groupCall?.isLoaded, isActive, subscribeToGroupCallUpdates]);
|
||||
|
||||
const renderingParticipantCount = useCurrentOrPrev(groupCall?.participantsCount, true);
|
||||
const renderingFetchedParticipants = useCurrentOrPrev(fetchedParticipants, true);
|
||||
|
||||
|
||||
@ -107,9 +107,11 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
if (!isOutgoing && call.state === 'requested') {
|
||||
onTickEnd(() => {
|
||||
global = getGlobal();
|
||||
const user = selectPhoneCallUser(global);
|
||||
if (!user) return;
|
||||
notifyAboutCall({
|
||||
call,
|
||||
user: selectPhoneCallUser(global)!,
|
||||
user,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -131,26 +131,6 @@ addActionHandler('toggleGroupCallPanel', (global, actions, payload): ActionRetur
|
||||
}, tabId);
|
||||
});
|
||||
|
||||
addActionHandler('subscribeToGroupCallUpdates', async (global, actions, payload): Promise<void> => {
|
||||
if (selectIsCurrentUserFrozen(global)) return;
|
||||
|
||||
const { subscribed, id } = payload;
|
||||
const groupCall = selectGroupCall(global, id);
|
||||
|
||||
if (!groupCall) return;
|
||||
|
||||
if (subscribed) {
|
||||
await fetchGroupCall(global, groupCall);
|
||||
global = getGlobal();
|
||||
await requestGroupCallParticipants(groupCall);
|
||||
}
|
||||
|
||||
await callApi('toggleGroupCallStartSubscription', {
|
||||
subscribed,
|
||||
call: groupCall,
|
||||
});
|
||||
});
|
||||
|
||||
addActionHandler('createGroupCall', async (global, actions, payload): Promise<void> => {
|
||||
const { chatId, tabId = getCurrentTabId() } = payload;
|
||||
|
||||
@ -341,7 +321,7 @@ addActionHandler('joinGroupCall', async (global, actions, payload): Promise<void
|
||||
addActionHandler('playGroupCallSound', (global, actions, payload): ActionReturnType => {
|
||||
const { sound } = payload;
|
||||
|
||||
if (!sounds[sound]) {
|
||||
if (!sounds?.[sound]) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -2265,10 +2265,6 @@ export interface ActionPayloads {
|
||||
username: string;
|
||||
inviteHash: string;
|
||||
} & WithTabId;
|
||||
subscribeToGroupCallUpdates: {
|
||||
subscribed: boolean;
|
||||
id: string;
|
||||
};
|
||||
createGroupCallInviteLink: WithTabId | undefined;
|
||||
|
||||
loadMoreGroupCallParticipants: undefined;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user