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