HTML5 Client - changed sound for unreadMessages function from nav-bar to app
This commit is contained in:
parent
0a4248d144
commit
e92e75564a
@ -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 (
|
||||
<KickedScreen>
|
||||
@ -176,6 +187,7 @@ export default class App extends Component {
|
||||
<section className={styles.wrapper}>
|
||||
{this.renderUserList()}
|
||||
{this.renderChat()}
|
||||
{this.renderSoundUnreadeMessages()}
|
||||
<div className={styles.content}>
|
||||
{this.renderNavBar()}
|
||||
{this.renderMedia()}
|
||||
|
@ -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: <NavBarContainer />,
|
||||
@ -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);
|
||||
|
@ -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 {
|
||||
<div className={styles.right}>
|
||||
<SettingsDropdown />
|
||||
</div>
|
||||
{hasUnreadMessages ? this.soundForUnreadeMessages() : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user