Skip to content
Snippets Groups Projects
Commit bca4ed29 authored by Alec Troemel's avatar Alec Troemel
Browse files

livechat client app sound notification option

parent a2f74623
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,11 @@ msgStream = new Meteor.Streamer 'room-messages'
else
ChatMessage.upsert { _id: msg._id }, msg
# notification sound
if Session.equals('sound', true)
if msg.u._id isnt Meteor.user()._id
$('#chatAudioNotification')[0].play();
register: register
getToken: getToken
setRoom: setRoom
......
......@@ -3,6 +3,13 @@
<div class="livechat-room">
<div class="title" style="background-color:{{color}}">
<div class="toolbar">
&nbsp;
{{#if soundActive}}
<i class="sound icon-bell-alt" title="Toggle notification sound"></i>
{{else}}
<i class="sound icon-bell-off" title="toggle notification sound"></i>
{{/if}}
&nbsp;
{{#unless popoutActive}}
<i class="popout icon-link-ext" title="Open in a new window"></i>
......
......@@ -9,6 +9,9 @@ Template.livechatWindow.helpers({
popoutActive() {
return FlowRouter.getQueryParam('mode') === 'popout';
},
soundActive() {
return Session.get('sound');
},
showRegisterForm() {
if (Session.get('triggered') || Meteor.userId()) {
return false;
......@@ -33,6 +36,10 @@ Template.livechatWindow.events({
'click .popout'(event) {
event.stopPropagation();
parentCall('openPopout');
},
'click .sound'(event) {
event.stopPropagation();
Session.set({sound: !Session.get('sound')});
}
});
......@@ -44,6 +51,8 @@ Template.livechatWindow.onCreated(function() {
this.registrationForm = new ReactiveVar(true);
this.offlineMessage = new ReactiveVar('');
Session.set({sound: true});
// get all needed live chat info for the user
Meteor.call('livechat:getInitialData', visitor.getToken(), (err, result) => {
if (err) {
......
......@@ -8,6 +8,9 @@
<meta name="distribution" content="global" />
<meta name="rating" content="general" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<audio id="chatAudioNotification" preload>
<source src="/sounds/notify.mp3" type="audio/mpeg" />
</audio>
</head>
<body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment