Don't ring large groups
This commit is contained in:
parent
1f45bce0a2
commit
3e18a8a337
13 changed files with 144 additions and 44 deletions
|
@ -70,7 +70,6 @@ const createProps = (storyProps: Partial<PropsType> = {}): PropsType => ({
|
|||
i18n,
|
||||
isGroupCallOutboundRingEnabled: true,
|
||||
keyChangeOk: action('key-change-ok'),
|
||||
maxGroupCallRingSize: 16,
|
||||
me: {
|
||||
...getDefaultConversation({
|
||||
color: select(
|
||||
|
|
|
@ -81,7 +81,6 @@ export type PropsType = {
|
|||
declineCall: (_: DeclineCallType) => void;
|
||||
i18n: LocalizerType;
|
||||
isGroupCallOutboundRingEnabled: boolean;
|
||||
maxGroupCallRingSize: number;
|
||||
me: MeType;
|
||||
notifyForCall: (title: string, isVideoCall: boolean) => unknown;
|
||||
openSystemPreferencesAction: () => unknown;
|
||||
|
@ -116,7 +115,6 @@ const ActiveCallManager: React.FC<ActiveCallManagerPropsType> = ({
|
|||
keyChangeOk,
|
||||
getGroupCallVideoFrameSource,
|
||||
getPresentingSources,
|
||||
maxGroupCallRingSize,
|
||||
me,
|
||||
openSystemPreferencesAction,
|
||||
renderDeviceSelection,
|
||||
|
@ -234,7 +232,6 @@ const ActiveCallManager: React.FC<ActiveCallManagerPropsType> = ({
|
|||
isGroupCall={activeCall.callMode === CallMode.Group}
|
||||
isGroupCallOutboundRingEnabled={isGroupCallOutboundRingEnabled}
|
||||
isCallFull={isCallFull}
|
||||
maxGroupCallRingSize={maxGroupCallRingSize}
|
||||
me={me}
|
||||
onCallCanceled={cancelActiveCall}
|
||||
onJoinCall={joinActiveCall}
|
||||
|
|
|
@ -57,7 +57,6 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => {
|
|||
isGroupCall,
|
||||
isGroupCallOutboundRingEnabled: true,
|
||||
isCallFull: boolean('isCallFull', overrideProps.isCallFull || false),
|
||||
maxGroupCallRingSize: overrideProps.maxGroupCallRingSize || 16,
|
||||
me: overrideProps.me || {
|
||||
color: AvatarColors[0],
|
||||
id: generateUuid(),
|
||||
|
|
|
@ -20,6 +20,7 @@ import {
|
|||
import { AvatarColorType } from '../types/Colors';
|
||||
import { LocalizerType } from '../types/Util';
|
||||
import { ConversationType } from '../state/ducks/conversations';
|
||||
import { isConversationTooBigToRing } from '../conversations/isConversationTooBigToRing';
|
||||
|
||||
export type PropsType = {
|
||||
availableCameras: Array<MediaDeviceInfo>;
|
||||
|
@ -29,6 +30,7 @@ export type PropsType = {
|
|||
| 'avatarPath'
|
||||
| 'color'
|
||||
| 'isMe'
|
||||
| 'memberships'
|
||||
| 'name'
|
||||
| 'phoneNumber'
|
||||
| 'profileName'
|
||||
|
@ -44,7 +46,6 @@ export type PropsType = {
|
|||
isGroupCall: boolean;
|
||||
isGroupCallOutboundRingEnabled: boolean;
|
||||
isCallFull?: boolean;
|
||||
maxGroupCallRingSize: number;
|
||||
me: {
|
||||
avatarPath?: string;
|
||||
id: string;
|
||||
|
@ -74,7 +75,6 @@ export const CallingLobby = ({
|
|||
isGroupCall = false,
|
||||
isGroupCallOutboundRingEnabled,
|
||||
isCallFull = false,
|
||||
maxGroupCallRingSize,
|
||||
me,
|
||||
onCallCanceled,
|
||||
onJoinCall,
|
||||
|
@ -150,21 +150,30 @@ export const CallingLobby = ({
|
|||
? CallingButtonType.AUDIO_ON
|
||||
: CallingButtonType.AUDIO_OFF;
|
||||
|
||||
const isGroupTooLargeToRing = isConversationTooBigToRing(conversation);
|
||||
|
||||
const isRingButtonVisible: boolean =
|
||||
isGroupCall &&
|
||||
isGroupCallOutboundRingEnabled &&
|
||||
peekedParticipants.length === 0 &&
|
||||
(groupMembers || []).length > 1;
|
||||
|
||||
const preCallInfoRingMode: RingMode =
|
||||
isGroupCall && !outgoingRing ? RingMode.WillNotRing : RingMode.WillRing;
|
||||
let preCallInfoRingMode: RingMode;
|
||||
if (isGroupCall) {
|
||||
preCallInfoRingMode =
|
||||
outgoingRing && !isGroupTooLargeToRing
|
||||
? RingMode.WillRing
|
||||
: RingMode.WillNotRing;
|
||||
} else {
|
||||
preCallInfoRingMode = RingMode.WillRing;
|
||||
}
|
||||
|
||||
let ringButtonType:
|
||||
| CallingButtonType.RING_DISABLED
|
||||
| CallingButtonType.RING_ON
|
||||
| CallingButtonType.RING_OFF;
|
||||
if (isRingButtonVisible) {
|
||||
if ((groupMembers || []).length > maxGroupCallRingSize) {
|
||||
if (isGroupTooLargeToRing) {
|
||||
ringButtonType = CallingButtonType.RING_DISABLED;
|
||||
} else if (outgoingRing) {
|
||||
ringButtonType = CallingButtonType.RING_ON;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue