From 69a4de5ff27a7c00b517b4a9a7cead25bb35fbd7 Mon Sep 17 00:00:00 2001 From: Bobak Oftadeh Date: Mon, 18 Jun 2018 13:23:20 -0700 Subject: [PATCH] Fullscreen button only gets added on Android --- .../nav-bar/settings-dropdown/component.jsx | 75 +++++++++---------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/component.jsx index 8001fdd506..41acdb8268 100755 --- a/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/component.jsx @@ -87,48 +87,11 @@ class SettingsDropdown extends Component { this.onActionsShow = this.onActionsShow.bind(this); this.onActionsHide = this.onActionsHide.bind(this); - this.getListItems = this.getListItems.bind(this); } componentWillMount() { - this.createMenu(); - } - - componentWillReceiveProps(nextProps) { - this.alterMenu(nextProps); - } - - onActionsShow() { - this.setState({ - isSettingOpen: true, - }); - } - - onActionsHide() { - this.setState({ - isSettingOpen: false, - }); - } - - getListItems() { - const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent); - - // we slice the list item to be hidden, for iOS devices, in order to avoid the error - // thrown if the DropdownList receives a null value. - return (iOS) ? this.menuItems.slice(1) : this.menuItems; - } - - createMenu() { const { intl, mountModal } = this.props; - const { fullscreenLabel, fullscreenDesc, fullscreenIcon } = this.checkFullscreen(this.props); this.menuItems = [ - (), ( mountModal()} />), ]; + // Adds Fullscreen button if user is on Android. + if (/android/i.test(navigator.userAgent)) { + const { fullscreenLabel, fullscreenDesc, fullscreenIcon } = this.checkFullscreen(this.props); + const newFullScreenButton = (); + this.menuItems.unshift(newFullScreenButton); + } + } + + componentWillReceiveProps(nextProps) { + // Alters fullscreen button's label + if (/android/i.test(navigator.userAgent)) { + this.alterMenu(nextProps); + } + } + + onActionsShow() { + this.setState({ + isSettingOpen: true, + }); + } + + onActionsHide() { + this.setState({ + isSettingOpen: false, + }); } checkFullscreen(nextProps) { @@ -190,9 +184,8 @@ class SettingsDropdown extends Component { description={fullscreenDesc} onClick={this.props.handleToggleFullscreen} />); - const result = this.menuItems.slice(1); - result.unshift(newFullScreenButton); - this.menuItems = result; + this.menuItems = this.menuItems.slice(1); + this.menuItems.unshift(newFullScreenButton); } render() { @@ -222,7 +215,7 @@ class SettingsDropdown extends Component { { - this.getListItems() + this.menuItems }