fix(RN): show the CC button only when transcribing is available

This commit is contained in:
paweldomas 2018-09-06 15:18:14 -05:00 committed by Любомир Маринов
parent f148b50100
commit ee9f304345
2 changed files with 14 additions and 17 deletions

View File

@ -74,15 +74,24 @@ export class AbstractClosedCaptionButton
* {@code AbstractClosedCaptionButton} component. * {@code AbstractClosedCaptionButton} component.
* *
* @param {Object} state - The redux state. * @param {Object} state - The redux state.
* @param {Object} ownProps - The properties explicitly passed to the component
* instance.
* @private * @private
* @returns {{ * @returns {{
* __requestingSubtitles: boolean * _requestingSubtitles: boolean,
* visible: boolean
* }} * }}
*/ */
export function _abstractMapStateToProps(state: Object) { export function _abstractMapStateToProps(state: Object, ownProps: Object) {
const { _requestingSubtitles } = state['features/subtitles']; const { _requestingSubtitles } = state['features/subtitles'];
const { transcribingEnabled } = state['features/base/config'];
// Default 'visible' to 'transcribingEnabled' if not explicitly specified
// in the component's properties.
const { visible = transcribingEnabled } = ownProps;
return { return {
_requestingSubtitles _requestingSubtitles,
visible
}; };
} }

View File

@ -157,17 +157,11 @@ type Props = {
*/ */
_sharingVideo: boolean, _sharingVideo: boolean,
/**
* Whether or not transcribing is enabled.
*/
_transcribingEnabled: boolean,
/** /**
* Flag showing whether toolbar is visible. * Flag showing whether toolbar is visible.
*/ */
_visible: boolean, _visible: boolean,
/** /**
* Set with the buttons which this Toolbox should display. * Set with the buttons which this Toolbox should display.
*/ */
@ -323,7 +317,6 @@ class Toolbox extends Component<Props> {
_chatOpen, _chatOpen,
_hideInviteButton, _hideInviteButton,
_overflowMenuVisible, _overflowMenuVisible,
_transcribingEnabled,
_raisedHand, _raisedHand,
_visible, _visible,
_visibleButtons, _visibleButtons,
@ -367,8 +360,7 @@ class Toolbox extends Component<Props> {
<ChatCounter /> <ChatCounter />
</div> } </div> }
{ {
_transcribingEnabled this._shouldShowButton('closedcaptions')
&& this._shouldShowButton('closedcaptions')
&& <ClosedCaptionButton /> && <ClosedCaptionButton />
} }
</div> </div>
@ -1039,9 +1031,6 @@ function _mapStateToProps(state) {
callStatsID, callStatsID,
iAmRecorder iAmRecorder
} = state['features/base/config']; } = state['features/base/config'];
const {
transcribingEnabled
} = state['features/base/config'];
const sharedVideoStatus = state['features/shared-video'].status; const sharedVideoStatus = state['features/shared-video'].status;
const { current } = state['features/side-panel']; const { current } = state['features/side-panel'];
const { const {
@ -1094,7 +1083,6 @@ function _mapStateToProps(state) {
_overflowMenuVisible: overflowMenuVisible, _overflowMenuVisible: overflowMenuVisible,
_raisedHand: localParticipant.raisedHand, _raisedHand: localParticipant.raisedHand,
_screensharing: localVideo && localVideo.videoType === 'desktop', _screensharing: localVideo && localVideo.videoType === 'desktop',
_transcribingEnabled: transcribingEnabled,
_sharingVideo: sharedVideoStatus === 'playing' _sharingVideo: sharedVideoStatus === 'playing'
|| sharedVideoStatus === 'start' || sharedVideoStatus === 'start'
|| sharedVideoStatus === 'pause', || sharedVideoStatus === 'pause',