mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 05:11:55 +01:00
Calls: Various fixes (#1561)
This commit is contained in:
parent
0575fc6e00
commit
04024c356f
@ -32,6 +32,10 @@ const ActiveCallHeader: FC<StateProps & DispatchProps> = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.body.classList.toggle('has-group-call-header', isGroupCallPanelHidden);
|
document.body.classList.toggle('has-group-call-header', isGroupCallPanelHidden);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.body.classList.toggle('has-group-call-header', false);
|
||||||
|
};
|
||||||
}, [isGroupCallPanelHidden]);
|
}, [isGroupCallPanelHidden]);
|
||||||
|
|
||||||
if (!groupCall || !meParticipant) return undefined;
|
if (!groupCall || !meParticipant) return undefined;
|
||||||
|
@ -184,6 +184,13 @@ const GroupCall: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
}
|
}
|
||||||
}, [closeFullscreen, isFullscreen, openFullscreen]);
|
}, [closeFullscreen, isFullscreen, openFullscreen]);
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
toggleGroupCallPanel();
|
||||||
|
if (isFullscreen) {
|
||||||
|
closeFullscreen();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!IS_REQUEST_FULLSCREEN_SUPPORTED) return undefined;
|
if (!IS_REQUEST_FULLSCREEN_SUPPORTED) return undefined;
|
||||||
const container = containerRef.current;
|
const container = containerRef.current;
|
||||||
@ -302,7 +309,7 @@ const GroupCall: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
round
|
round
|
||||||
size="smaller"
|
size="smaller"
|
||||||
color="translucent"
|
color="translucent"
|
||||||
onClick={toggleGroupCallPanel}
|
onClick={handleClose}
|
||||||
>
|
>
|
||||||
<i className="icon-close" />
|
<i className="icon-close" />
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -8,7 +8,6 @@ import { pick } from '../../../util/iteratees';
|
|||||||
import useLang from '../../../hooks/useLang';
|
import useLang from '../../../hooks/useLang';
|
||||||
import { selectActiveGroupCall } from '../../../modules/selectors/calls';
|
import { selectActiveGroupCall } from '../../../modules/selectors/calls';
|
||||||
import useInfiniteScroll from '../../../hooks/useInfiniteScroll';
|
import useInfiniteScroll from '../../../hooks/useInfiniteScroll';
|
||||||
import { selectChat } from '../../../modules/selectors';
|
|
||||||
|
|
||||||
import GroupCallParticipant from './GroupCallParticipant';
|
import GroupCallParticipant from './GroupCallParticipant';
|
||||||
import InfiniteScroll from '../../ui/InfiniteScroll';
|
import InfiniteScroll from '../../ui/InfiniteScroll';
|
||||||
@ -31,7 +30,6 @@ const GroupCallParticipantList: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
participants,
|
participants,
|
||||||
participantsCount,
|
participantsCount,
|
||||||
openParticipantMenu,
|
openParticipantMenu,
|
||||||
canInvite,
|
|
||||||
}) => {
|
}) => {
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|
||||||
@ -47,14 +45,12 @@ const GroupCallParticipantList: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="participants">
|
<div className="participants">
|
||||||
{canInvite && (
|
<div className="invite-btn" onClick={createGroupCallInviteLink}>
|
||||||
<div className="invite-btn" onClick={createGroupCallInviteLink}>
|
<div className="icon">
|
||||||
<div className="icon">
|
<i className="icon-add-user" />
|
||||||
<i className="icon-add-user" />
|
|
||||||
</div>
|
|
||||||
<div className="text">{lang('VoipGroupInviteMember')}</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
<div className="text">{lang('VoipGroupInviteMember')}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<InfiniteScroll
|
<InfiniteScroll
|
||||||
items={viewportIds}
|
items={viewportIds}
|
||||||
@ -79,13 +75,11 @@ const GroupCallParticipantList: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): StateProps => {
|
||||||
const { participantsCount, participants, chatId } = selectActiveGroupCall(global) || {};
|
const { participantsCount, participants } = selectActiveGroupCall(global) || {};
|
||||||
const chat = chatId && selectChat(global, chatId);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
participants,
|
participants,
|
||||||
participantsCount: participantsCount || 0,
|
participantsCount: participantsCount || 0,
|
||||||
canInvite: !!chat && !!chat.username,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
(setGlobal, actions): DispatchProps => pick(actions, [
|
(setGlobal, actions): DispatchProps => pick(actions, [
|
||||||
|
@ -222,7 +222,6 @@ function updateCache() {
|
|||||||
'shouldShowContextMenuHint',
|
'shouldShowContextMenuHint',
|
||||||
'leftColumnWidth',
|
'leftColumnWidth',
|
||||||
'serviceNotifications',
|
'serviceNotifications',
|
||||||
// TODO Support 'groupCalls'
|
|
||||||
]),
|
]),
|
||||||
audioPlayer: {
|
audioPlayer: {
|
||||||
volume: global.audioPlayer.volume,
|
volume: global.audioPlayer.volume,
|
||||||
|
@ -149,19 +149,31 @@ addReducer('createGroupCall', (global, actions, payload) => {
|
|||||||
addReducer('createGroupCallInviteLink', (global, actions) => {
|
addReducer('createGroupCallInviteLink', (global, actions) => {
|
||||||
const groupCall = selectActiveGroupCall(global);
|
const groupCall = selectActiveGroupCall(global);
|
||||||
|
|
||||||
if (!groupCall) {
|
if (!groupCall || !groupCall.chatId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const chat = selectChat(global, groupCall.chatId);
|
||||||
|
if (!chat) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const canInvite = !!chat && !!chat.username;
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const result = await callApi('exportGroupCallInvite', {
|
let { inviteLink } = chat.fullInfo!;
|
||||||
call: groupCall,
|
if (canInvite) {
|
||||||
canSelfUnmute: false,
|
inviteLink = await callApi('exportGroupCallInvite', {
|
||||||
});
|
call: groupCall,
|
||||||
|
canSelfUnmute: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!result) return;
|
if (!inviteLink) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
copyTextToClipboard(result);
|
copyTextToClipboard(inviteLink);
|
||||||
actions.showNotification({
|
actions.showNotification({
|
||||||
message: 'Link copied to clipboard',
|
message: 'Link copied to clipboard',
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user