diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index e136537c..b4b5c55a 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -453,6 +453,10 @@
}
}
},
+ "audioNotificationDescription": {
+ "message": "Play audio notification",
+ "description": "Description for audio notification setting"
+ },
"safetyNumbersSettingHeader": {
"message": "Safety numbers approval",
"description": "Header for safety numbers setting"
diff --git a/audio/NewMessage.mp3 b/audio/NewMessage.mp3
new file mode 100644
index 00000000..93beaf7a
Binary files /dev/null and b/audio/NewMessage.mp3 differ
diff --git a/background.html b/background.html
index 6a41305d..f30d6941 100644
--- a/background.html
+++ b/background.html
@@ -463,6 +463,11 @@
+
+
+
+
+
{{ safetyNumbersSettingHeader }}
diff --git a/js/notifications.js b/js/notifications.js
index 9e9bbbe4..12961e88 100644
--- a/js/notifications.js
+++ b/js/notifications.js
@@ -12,6 +12,8 @@
MESSAGE : 'message'
};
+ var sound = new Audio('/audio/NewMessage.mp3');
+
Whisper.Notifications = new (Backbone.Collection.extend({
initialize: function() {
this.on('add', _.debounce(this.update.bind(this), 1000));
@@ -35,6 +37,11 @@
if (this.length === 0) {
return;
}
+ var audioNotification = storage.get('audio-notification') || false;
+ if (audioNotification) {
+ sound.play();
+ }
+
var setting = storage.get('notification-setting') || 'message';
if (setting === SETTINGS.OFF) {
return;
diff --git a/js/views/settings_view.js b/js/views/settings_view.js
index b801b4e2..7afb8091 100644
--- a/js/views/settings_view.js
+++ b/js/views/settings_view.js
@@ -59,6 +59,11 @@
defaultValue: 'android',
name: 'theme-setting'
});
+ new CheckboxView({
+ el: this.$('.audio-notification-setting'),
+ defaultValue: false,
+ name: 'audio-notification'
+ });
new CheckboxView({
el: this.$('.safety-numbers-settings'),
defaultValue: true,
@@ -84,6 +89,7 @@
nameOnly: i18n('nameOnly'),
safetyNumbersSettingDescription: i18n('safetyNumbersSettingDescription'),
safetyNumbersSettingHeader: i18n('safetyNumbersSettingHeader'),
+ audioNotificationDescription: i18n('audioNotificationDescription'),
themeAndroidDark: i18n('themeAndroidDark'),
};
}