diff --git a/assets/sounds/alert.mp3 b/assets/sounds/alert.mp3
new file mode 100644
index 000000000..f1779dfe9
Binary files /dev/null and b/assets/sounds/alert.mp3 differ
diff --git a/assets/sounds/alert.ogg b/assets/sounds/alert.ogg
new file mode 100644
index 000000000..e848b3f42
Binary files /dev/null and b/assets/sounds/alert.ogg differ
diff --git a/assets/sounds/ping.mp3 b/assets/sounds/ping.mp3
new file mode 100644
index 000000000..52885ece8
Binary files /dev/null and b/assets/sounds/ping.mp3 differ
diff --git a/assets/sounds/ping.ogg b/assets/sounds/ping.ogg
new file mode 100644
index 000000000..6620ded87
Binary files /dev/null and b/assets/sounds/ping.ogg differ
diff --git a/dev/Common/Audio.js b/dev/Common/Audio.js
index d6d9f5aeb..26660d695 100644
--- a/dev/Common/Audio.js
+++ b/dev/Common/Audio.js
@@ -1,5 +1,5 @@
import * as Links from 'Common/Links';
-import { doc } from 'Common/Globals';
+import { doc, SettingsGet } from 'Common/Globals';
let notificator = null,
player = null,
@@ -106,11 +106,11 @@ export const SMAudio = new class {
playNotification(silent) {
if ('running' == audioCtx.state && (this.supportedMp3 || this.supportedOgg)) {
- if (!notificator) {
- notificator = createNewObject();
- notificator.src = Links.staticLink('sounds/new-mail.'+ (this.supportedMp3 ? 'mp3' : 'ogg'));
- }
+ notificator = notificator || createNewObject();
if (notificator) {
+ notificator.src = Links.staticLink('sounds/'
+ + SettingsGet('NotificationSound')
+ + (this.supportedMp3 ? '.mp3' : '.ogg'));
notificator.volume = silent ? 0.01 : 1;
notificator.play();
}
diff --git a/dev/Settings/User/General.js b/dev/Settings/User/General.js
index ed49b0af6..9df238ca7 100644
--- a/dev/Settings/User/General.js
+++ b/dev/Settings/User/General.js
@@ -32,6 +32,8 @@ export class GeneralUserSettings {
this.layout = SettingsUserStore.layout;
this.enableSoundNotification = NotificationUserStore.enableSoundNotification;
+ this.notificationSound = ko.observable(SettingsGet('NotificationSound'));
+ this.notificationSounds = ko.observableArray(SettingsGet('NewMailSounds'));
this.enableDesktopNotification = NotificationUserStore.enableDesktopNotification;
this.isDesktopNotificationDenied = NotificationUserStore.isDesktopNotificationDenied;
@@ -115,6 +117,10 @@ export class GeneralUserSettings {
enableDesktopNotification: value => Remote.saveSetting('DesktopNotifications', value ? 1 : 0),
enableSoundNotification: value => Remote.saveSetting('SoundNotification', value ? 1 : 0),
+ notificationSound: value => {
+ Remote.saveSetting('NotificationSound', value);
+ rl.settings.set('NotificationSound', value);
+ },
replySameFolder: value => Remote.saveSetting('ReplySameFolder', value ? 1 : 0),
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php
index c73a6404c..c0b8e42a2 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php
@@ -1060,6 +1060,7 @@ class Actions
'RemoveColors' => (bool) $oConfig->Get('defaults', 'remove_colors', false),
'MPP' => (int) $oConfig->Get('webmail', 'messages_per_page', 25),
'SoundNotification' => false,
+ 'NotificationSound' => 'new-mail',
'DesktopNotifications' => false,
'Layout' => (int) $oConfig->Get('defaults', 'view_layout', Enumerations\Layout::SIDE_PREVIEW),
'EditorDefaultType' => (string) $oConfig->Get('defaults', 'view_editor_type', ''),
@@ -1165,6 +1166,7 @@ class Actions
$aResult['ContactsAutosave'] = (bool)$oSettings->GetConf('ContactsAutosave', $aResult['ContactsAutosave']);
$aResult['MPP'] = (int)$oSettings->GetConf('MPP', $aResult['MPP']);
$aResult['SoundNotification'] = (bool)$oSettings->GetConf('SoundNotification', $aResult['SoundNotification']);
+ $aResult['NotificationSound'] = (string)$oSettings->GetConf('NotificationSound', $aResult['NotificationSound']);
$aResult['DesktopNotifications'] = (bool)$oSettings->GetConf('DesktopNotifications', $aResult['DesktopNotifications']);
$aResult['UseCheckboxesInList'] = (bool)$oSettings->GetConf('UseCheckboxesInList', $aResult['UseCheckboxesInList']);
$aResult['AllowDraftAutosave'] = (bool)$oSettings->GetConf('AllowDraftAutosave', $aResult['AllowDraftAutosave']);
@@ -1186,6 +1188,10 @@ class Actions
$aResult['ReplySameFolder'] = (bool)$oSettingsLocal->GetConf('ReplySameFolder', $aResult['ReplySameFolder']);
}
}
+ $aResult['NewMailSounds'] = [];
+ foreach (\glob(APP_VERSION_ROOT_PATH.'static/sounds/*.mp3') as $file) {
+ $aResult['NewMailSounds'][] = \basename($file, '.mp3');
+ }
}
else {
if ($oConfig->Get('login', 'allow_languages_on_login', true)
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php
index dfcd1bd5c..05f4e98b5 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/User.php
@@ -347,6 +347,7 @@ trait User
$this->setSettingsFromParams($oSettings, 'ContactsAutosave', 'bool');
$this->setSettingsFromParams($oSettings, 'DesktopNotifications', 'bool');
$this->setSettingsFromParams($oSettings, 'SoundNotification', 'bool');
+ $this->setSettingsFromParams($oSettings, 'NotificationSound', 'string');
$this->setSettingsFromParams($oSettings, 'UseCheckboxesInList', 'bool');
$this->setSettingsFromParams($oSettings, 'AllowDraftAutosave', 'bool');
$this->setSettingsFromParams($oSettings, 'AutoLogout', 'int');
diff --git a/snappymail/v/0.0.0/app/templates/Views/User/SettingsGeneral.html b/snappymail/v/0.0.0/app/templates/Views/User/SettingsGeneral.html
index c3aa316dc..02f169b0c 100644
--- a/snappymail/v/0.0.0/app/templates/Views/User/SettingsGeneral.html
+++ b/snappymail/v/0.0.0/app/templates/Views/User/SettingsGeneral.html
@@ -132,6 +132,8 @@
}
}">
+
+
▶️