Make os notifications respect our sound setting (#1445)
This removes our custom notification sound in favor of the system sound, and ensures that the system sound is disabled if the user unchecks the audio notification option. // FREEBIE
This commit is contained in:
parent
f389380b26
commit
1b444a5e23
2 changed files with 4 additions and 8 deletions
Binary file not shown.
|
@ -12,8 +12,6 @@
|
||||||
MESSAGE : 'message'
|
MESSAGE : 'message'
|
||||||
};
|
};
|
||||||
|
|
||||||
var sound = new Audio('audio/NewMessage.mp3');
|
|
||||||
|
|
||||||
Whisper.Notifications = new (Backbone.Collection.extend({
|
Whisper.Notifications = new (Backbone.Collection.extend({
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.on('add', this.update);
|
this.on('add', this.update);
|
||||||
|
@ -34,9 +32,6 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var audioNotification = storage.get('audio-notification') || false;
|
var audioNotification = storage.get('audio-notification') || false;
|
||||||
if (audioNotification) {
|
|
||||||
sound.play();
|
|
||||||
}
|
|
||||||
|
|
||||||
var setting = storage.get('notification-setting') || 'message';
|
var setting = storage.get('notification-setting') || 'message';
|
||||||
if (setting === SETTINGS.OFF) {
|
if (setting === SETTINGS.OFF) {
|
||||||
|
@ -70,9 +65,10 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var notification = new Notification(title, {
|
var notification = new Notification(title, {
|
||||||
body : message,
|
body : message,
|
||||||
icon : iconUrl,
|
icon : iconUrl,
|
||||||
tag : 'signal'
|
tag : 'signal',
|
||||||
|
silent : !audioNotification
|
||||||
});
|
});
|
||||||
notification.onclick = this.onclick.bind(this);
|
notification.onclick = this.onclick.bind(this);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue