@@ -50,97 +50,6 @@ ComposerAvatar.propTypes = {
5050 me : PropTypes . object . isRequired ,
5151} ;
5252
53- function CallButton ( props ) {
54- const onVoiceCallClick = ( ev ) => {
55- dis . dispatch ( {
56- action : 'place_call' ,
57- type : PlaceCallType . Voice ,
58- room_id : props . roomId ,
59- } ) ;
60- } ;
61-
62- return ( < AccessibleTooltipButton
63- className = "mx_MessageComposer_button mx_MessageComposer_voicecall"
64- onClick = { onVoiceCallClick }
65- title = { _t ( 'Voice call' ) }
66- /> ) ;
67- }
68-
69- CallButton . propTypes = {
70- roomId : PropTypes . string . isRequired ,
71- } ;
72-
73- function VideoCallButton ( props ) {
74- const onCallClick = ( ev ) => {
75- dis . dispatch ( {
76- action : 'place_call' ,
77- type : ev . shiftKey ? PlaceCallType . ScreenSharing : PlaceCallType . Video ,
78- room_id : props . roomId ,
79- } ) ;
80- } ;
81-
82- return < AccessibleTooltipButton
83- className = "mx_MessageComposer_button mx_MessageComposer_videocall"
84- onClick = { onCallClick }
85- title = { _t ( 'Video call' ) }
86- /> ;
87- }
88-
89- VideoCallButton . propTypes = {
90- roomId : PropTypes . string . isRequired ,
91- } ;
92-
93- function HangupButton ( props ) {
94- const onHangupClick = ( ) => {
95- if ( props . isConference ) {
96- dis . dispatch ( {
97- action : props . canEndConference ? 'end_conference' : 'hangup_conference' ,
98- room_id : props . roomId ,
99- } ) ;
100- return ;
101- }
102-
103- const call = CallHandler . sharedInstance ( ) . getCallForRoom ( props . roomId ) ;
104- if ( ! call ) {
105- return ;
106- }
107-
108- const action = call . state === CallState . Ringing ? 'reject' : 'hangup' ;
109-
110- dis . dispatch ( {
111- action,
112- // hangup the call for this room. NB. We use the room in props as the room ID
113- // as call.roomId may be the 'virtual room', and the dispatch actions always
114- // use the user-facing room (there was a time when we deliberately used
115- // call.roomId and *not* props.roomId, but that was for the old
116- // style Freeswitch conference calls and those times are gone.)
117- room_id : props . roomId ,
118- } ) ;
119- } ;
120-
121- let tooltip = _t ( "Hangup" ) ;
122- if ( props . isConference && props . canEndConference ) {
123- tooltip = _t ( "End conference" ) ;
124- }
125-
126- const canLeaveConference = ! props . isConference ? true : props . isInConference ;
127- return (
128- < AccessibleTooltipButton
129- className = "mx_MessageComposer_button mx_MessageComposer_hangup"
130- onClick = { onHangupClick }
131- title = { tooltip }
132- disabled = { ! canLeaveConference }
133- />
134- ) ;
135- }
136-
137- HangupButton . propTypes = {
138- roomId : PropTypes . string . isRequired ,
139- isConference : PropTypes . bool . isRequired ,
140- canEndConference : PropTypes . bool ,
141- isInConference : PropTypes . bool ,
142- } ;
143-
14453const EmojiButton = ( { addEmoji} ) => {
14554 const [ menuDisplayed , button , openMenu , closeMenu ] = useContextMenu ( ) ;
14655
@@ -265,7 +174,6 @@ export default class MessageComposer extends React.Component {
265174 this . state = {
266175 tombstone : this . _getRoomTombstone ( ) ,
267176 canSendMessages : this . props . room . maySendMessage ( ) ,
268- showCallButtons : SettingsStore . getValue ( "showCallButtonsInComposer" ) ,
269177 hasConference : WidgetStore . instance . doesRoomHaveConference ( this . props . room ) ,
270178 joinedConference : WidgetStore . instance . isJoinedToConferenceIn ( this . props . room ) ,
271179 } ;
@@ -405,12 +313,7 @@ export default class MessageComposer extends React.Component {
405313 ] ;
406314
407315 if ( ! this . state . tombstone && this . state . canSendMessages ) {
408- // This also currently includes the call buttons. Really we should
409- // check separately for whether we can call, but this is slightly
410- // complex because of conference calls.
411-
412316 const SendMessageComposer = sdk . getComponent ( "rooms.SendMessageComposer" ) ;
413- const callInProgress = this . props . callState && this . props . callState !== 'ended' ;
414317
415318 controls . push (
416319 < SendMessageComposer
@@ -430,30 +333,6 @@ export default class MessageComposer extends React.Component {
430333 SettingsStore . getValue ( "MessageComposerInput.showStickersButton" ) ) {
431334 controls . push ( < Stickerpicker key = "stickerpicker_controls_button" room = { this . props . room } /> ) ;
432335 }
433-
434- if ( this . state . showCallButtons ) {
435- if ( this . state . hasConference ) {
436- const canEndConf = WidgetUtils . canUserModifyWidgets ( this . props . room . roomId ) ;
437- controls . push (
438- < HangupButton
439- key = "controls_hangup"
440- roomId = { this . props . room . roomId }
441- isConference = { true }
442- canEndConference = { canEndConf }
443- isInConference = { this . state . joinedConference }
444- /> ,
445- ) ;
446- } else if ( callInProgress ) {
447- controls . push (
448- < HangupButton key = "controls_hangup" roomId = { this . props . room . roomId } isConference = { false } /> ,
449- ) ;
450- } else {
451- controls . push (
452- < CallButton key = "controls_call" roomId = { this . props . room . roomId } /> ,
453- < VideoCallButton key = "controls_videocall" roomId = { this . props . room . roomId } /> ,
454- ) ;
455- }
456- }
457336 } else if ( this . state . tombstone ) {
458337 const replacementRoomId = this . state . tombstone . getContent ( ) [ 'replacement_room' ] ;
459338
0 commit comments