Fix audio notifications on linux (#1526)

This partially reverts commit 1b444a5e23.
Because support for system-level notification sound settings is inconsistent
across Win/Linux/OSX, do the simplest thing that will produce consistent
behavior on all platforms: suppress the system sound by always passing the
`silent: true` option, and play our own sound clip (copied from ios).

// FREEBIE
This commit is contained in:
Lilia 2017-10-03 20:08:14 +02:00 committed by Scott Nonnenberg
parent 5e6d3156f9
commit 0b7543b0f6
2 changed files with 5 additions and 1 deletions

BIN
audio/NewMessage.mp3 Normal file

Binary file not shown.

View file

@ -13,6 +13,7 @@
};
var enabled = false;
var sound = new Audio('audio/NewMessage.mp3');
Whisper.Notifications = new (Backbone.Collection.extend({
initialize: function() {
@ -44,6 +45,9 @@
window.drawAttention();
var audioNotification = storage.get('audio-notification') || false;
if (audioNotification) {
sound.play();
}
var setting = storage.get('notification-setting') || 'message';
if (setting === SETTINGS.OFF) {
@ -84,7 +88,7 @@
body : message,
icon : iconUrl,
tag : 'signal',
silent : !audioNotification
silent : true
});
notification.onclick = this.onClick.bind(this, last.get('conversationId'));