From f71f62d19a627426ba18a192a467863bcff3af23 Mon Sep 17 00:00:00 2001 From: KDSBrowne Date: Mon, 13 Feb 2017 08:21:53 -0800 Subject: [PATCH] modified previous code structure --- .../ui/components/nav-bar/component.jsx | 4 +- .../nav-bar/settings-dropdown/component.jsx | 62 +++++++------------ .../nav-bar/settings-dropdown/container.jsx | 48 ++++++++++++++ .../nav-bar/settings-dropdown/service.js | 55 ++++++++++++++++ 4 files changed, 128 insertions(+), 41 deletions(-) create mode 100755 bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/container.jsx create mode 100755 bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/service.js diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx index 6f3ff8f7d5..0c5b31ed15 100755 --- a/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx @@ -7,7 +7,7 @@ import { showModal } from '/imports/ui/components/app/service'; import Button from '../button/component'; import RecordingIndicator from './recording-indicator/component'; -import SettingsDropdown from './settings-dropdown/component'; +import SettingsDropdownContainer from './settings-dropdown/container'; import Icon from '/imports/ui/components/icon/component'; import BreakoutJoinConfirmation from '/imports/ui/components/breakout-join-confirmation/component'; import Dropdown from '/imports/ui/components/dropdown/component'; @@ -85,7 +85,7 @@ class NavBar extends Component {
- +
); 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 80c37a67da..11ea3314eb 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 @@ -53,44 +53,16 @@ const intlMessages = defineMessages({ id: 'app.navBar.settingsDropdown.leaveSessionDesc', defaultMessage: 'Leave the meeting', }, + exitFullScreenDesc: { + id: 'app.navBar.settingsDropdown.exitFullScreenDesc', + defaultMessage: 'minimize the window', + }, + exitFullScreenLabel: { + id: 'app.navBar.settingsDropdown.exitFullScreenLabel', + defaultMessage: 'Exit fullscreen', + }, }); -const toggleFullScreen = () => { - let element = document.documentElement; - - if (document.fullscreenEnabled - || document.mozFullScreenEnabled - || document.webkitFullscreenEnabled) { - - // If the page is already fullscreen, exit fullscreen - if (document.fullscreenElement - || document.webkitFullscreenElement - || document.mozFullScreenElement - || document.msFullscreenElement) { - - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } - - // If the page is not currently fullscreen, make fullscreen - } else { - if (element.requestFullscreen) { - element.requestFullscreen(); - } else if (element.mozRequestFullScreen) { - element.mozRequestFullScreen(); - } else if (element.webkitRequestFullscreen) { - element.webkitRequestFullscreen(); - } else if (element.msRequestFullscreen) { - element.msRequestFullscreen(); - } - } - } -}; - const openSettings = () => showModal(); const openAbout = () => showModal(); @@ -103,7 +75,19 @@ class SettingsDropdown extends Component { } render() { + const { intl } = this.props; + + let fullScreenLabel; let fullScreenDesc; + + if(!this.props.isFullScreen){ + fullScreenLabel = intl.formatMessage(intlMessages.fullscreenLabel); + fullScreenDesc = intl.formatMessage(intlMessages.fullscreenDesc); + }else{ + fullScreenLabel = intl.formatMessage(intlMessages.exitFullScreenLabel); + fullScreenDesc = intl.formatMessage(intlMessages.exitFullScreenDesc); + } + return ( @@ -124,9 +108,9 @@ class SettingsDropdown extends Component { + ); + } +} diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/service.js b/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/service.js new file mode 100755 index 0000000000..7d1ac5795c --- /dev/null +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/settings-dropdown/service.js @@ -0,0 +1,55 @@ +import LocalStorage from '/imports/ui/services/storage/local.js'; + +toggleFullScreen = () => { + let element = document.documentElement; + + if (document.fullscreenEnabled + || document.mozFullScreenEnabled + || document.webkitFullscreenEnabled) { + + // If the page is already fullscreen, exit fullscreen + if (document.fullscreenElement + || document.webkitFullscreenElement + || document.mozFullScreenElement + || document.msFullscreenElement) { + + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } + minimize(); + + // If the page is not currently fullscreen, make fullscreen + } else { + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } + maximize(); + } + } +}; + +maximize = () => { + let maximizeScreen = new CustomEvent('bbb.maximizeScreen', { + status: 'maximized' }); + window.dispatchEvent(maximizeScreen); +}; + +minimize = () => { + let minimizeScreen = new CustomEvent('bbb.minimizeScreen', { + status: 'minimized' }); + window.dispatchEvent(minimizeScreen); +}; + +export { + toggleFullScreen, +};