From e92e75564a35c8b77fcd70008c05682ae17acc22 Mon Sep 17 00:00:00 2001 From: JaeeunCho Date: Thu, 22 Dec 2016 15:34:20 -0800 Subject: [PATCH] HTML5 Client - changed sound for unreadMessages function from nav-bar to app --- .../imports/ui/components/app/component.jsx | 12 ++++++++++++ .../imports/ui/components/app/container.jsx | 16 ++++++++++++++++ .../imports/ui/components/nav-bar/component.jsx | 8 +------- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/app/component.jsx b/bigbluebutton-html5/imports/ui/components/app/component.jsx index f26d28f621..83b9f1bde6 100755 --- a/bigbluebutton-html5/imports/ui/components/app/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/app/component.jsx @@ -19,6 +19,7 @@ const propTypes = { actionsbar: PropTypes.element, captions: PropTypes.element, modal: PropTypes.element, + hasUnreadMessages: PropTypes.bool, }; export default class App extends Component { @@ -149,7 +150,17 @@ export default class App extends Component { return false; } + renderSoundUnreadeMessages() { + const snd = new Audio('resources/sounds/notify.mp3'); + if(this.props.hasUnreadMessages) { + snd.play(); + } + } + render() { + + const { hasUnreadMessages } = this.props; + if (this.props.wasKicked) { return ( @@ -176,6 +187,7 @@ export default class App extends Component {
{this.renderUserList()} {this.renderChat()} + {this.renderSoundUnreadeMessages()}
{this.renderNavBar()} {this.renderMedia()} diff --git a/bigbluebutton-html5/imports/ui/components/app/container.jsx b/bigbluebutton-html5/imports/ui/components/app/container.jsx index 82fe9e6ad1..5835fb0ff5 100755 --- a/bigbluebutton-html5/imports/ui/components/app/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/app/container.jsx @@ -12,6 +12,12 @@ import NavBarContainer from '../nav-bar/container'; import ActionsBarContainer from '../actions-bar/container'; import MediaContainer from '../media/container'; import ClosedCaptionsContainer from '../closed-captions/container'; +import userListService from '../user-list/service'; +import Auth from '/imports/ui/services/auth'; +import ChatService from '../chat/service'; + +const CHAT_CONFIG = Meteor.settings.public.chat; +const PUBLIC_CHAT_KEY = CHAT_CONFIG.public_id; const defaultProps = { navbar: , @@ -50,6 +56,15 @@ const setLoading = (val) => { } }; +const checkUnreadMessages = () => { + let users = userListService.getUsers(); + return users + .map(user => user.id) + .filter(userID => userID !== Auth.userID) + .concat(PUBLIC_CHAT_KEY) + .some(receiverID => ChatService.hasUnreadMessages(receiverID)); +}; + export default createContainer(() => { Promise.all(subscribeForData()) .then(() => { @@ -60,6 +75,7 @@ export default createContainer(() => { wasKicked: wasUserKicked(), isLoading: getLoading(), modal: getModal(), + hasUnreadMessages: checkUnreadMessages(), redirectToLogoutUrl, }; }, AppContainer); diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx index e848d3d65d..de3adbf098 100755 --- a/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx @@ -59,12 +59,7 @@ class NavBar extends Component { openBreakoutJoinConfirmation.call(this, breakoutURL, breakout.name); }); } - - soundForUnreadeMessages() { - const snd = new Audio('resources/sounds/notify.mp3'); - snd.play(); - } - + render() { const { hasUnreadMessages, beingRecorded } = this.props; @@ -93,7 +88,6 @@ class NavBar extends Component {
- {hasUnreadMessages ? this.soundForUnreadeMessages() : null}
); }