EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Notification sound
Yurii27781c57e44b
diff --git a/application/Espo/Resources/i18n/en_US/Preferences.json b/application/Espo/Resources/i18n/en_US/Preferences.jsonindex 276433e4b6..12eeb41c86 100644--- a/application/Espo/Resources/i18n/en_US/Preferences.json+++ b/application/Espo/Resources/i18n/en_US/Preferences.json@@ -18,6 +18,7 @@"reactionNotifications": "In-app notifications about reactions","reactionNotificationsNotFollowed": "Notifications about reactions for non-followed records","notificationGrouping": "Group notifications",+ "notificationSound": "Notification Sound","autoFollowEntityTypeList": "Global Auto-Follow","signature": "Email Signature","dashboardTabList": "Tab List",diff --git a/application/Espo/Resources/i18n/en_US/Settings.json b/application/Espo/Resources/i18n/en_US/Settings.jsonindex c606dbc71c..1590605b09 100644--- a/application/Espo/Resources/i18n/en_US/Settings.json+++ b/application/Espo/Resources/i18n/en_US/Settings.json@@ -89,7 +89,6 @@"addressPreview": "Address Preview","addressFormat": "Address Format","personNameFormat": "Person Name Format",- "notificationSoundsDisabled": "Disable Notification Sounds","newNotificationCountInTitle": "Display new notification number in page title","applicationName": "Application Name","calendarEntityList": "Calendar Entity List",diff --git a/application/Espo/Resources/layouts/Preferences/detail.json b/application/Espo/Resources/layouts/Preferences/detail.jsonindex 9cf04365dc..41e7112f64 100644--- a/application/Espo/Resources/layouts/Preferences/detail.json+++ b/application/Espo/Resources/layouts/Preferences/detail.json@@ -150,7 +150,7 @@],[{"name": "notificationGrouping"},- false+ {"name": "notificationSound"}]]}diff --git a/application/Espo/Resources/metadata/app/aclPortal.json b/application/Espo/Resources/metadata/app/aclPortal.jsonindex 40652d57a9..e49fee77c0 100644--- a/application/Espo/Resources/metadata/app/aclPortal.json+++ b/application/Espo/Resources/metadata/app/aclPortal.json@@ -75,7 +75,8 @@"assignmentEmailNotificationsIgnoreEntityTypeList": false,"dashletsOptions": false,"dashboardLayout": false,- "followAsCollaborator": false+ "followAsCollaborator": false,+ "notificationSound": false},"Call": {"reminders": falsediff --git a/application/Espo/Resources/metadata/entityDefs/Preferences.json b/application/Espo/Resources/metadata/entityDefs/Preferences.jsonindex 47efa01c97..1e2fd34596 100644--- a/application/Espo/Resources/metadata/entityDefs/Preferences.json+++ b/application/Espo/Resources/metadata/entityDefs/Preferences.json@@ -119,6 +119,10 @@"type": "bool","default": true},+ "notificationSound": {+ "type": "bool",+ "default": false+ },"autoFollowEntityTypeList": {"type": "multiEnum","view": "views/preferences/fields/auto-follow-entity-type-list",diff --git a/application/Espo/Resources/metadata/entityDefs/Settings.json b/application/Espo/Resources/metadata/entityDefs/Settings.jsonindex 5a523c5471..116b48d712 100644--- a/application/Espo/Resources/metadata/entityDefs/Settings.json+++ b/application/Espo/Resources/metadata/entityDefs/Settings.json@@ -659,9 +659,6 @@"min": 0,"max": 20},- "notificationSoundsDisabled": {- "type": "bool"- },"calendarEntityList": {"type": "multiEnum","view": "views/settings/fields/calendar-entity-list",diff --git a/client/sounds/attribution.txt b/client/sounds/attribution.txtnew file mode 100644index 0000000000..53e7b211bc--- /dev/null+++ b/client/sounds/attribution.txt@@ -0,0 +1 @@+cloud.ogg sound effect is by Aarni Koskela.diff --git a/client/sounds/cloud.ogg b/client/sounds/cloud.oggnew file mode 100644index 0000000000..5e9ece1879Binary files /dev/null and b/client/sounds/cloud.ogg differdiff --git a/client/sounds/pop_cork.mp3 b/client/sounds/pop_cork.mp3deleted file mode 100644index 716643b5e9..0000000000Binary files a/client/sounds/pop_cork.mp3 and /dev/null differdiff --git a/client/sounds/pop_cork.ogg b/client/sounds/pop_cork.oggdeleted file mode 100644index 0fcb1eef98..0000000000Binary files a/client/sounds/pop_cork.ogg and /dev/null differdiff --git a/client/src/views/notification/badge.js b/client/src/views/notification/badge.jsindex 7c37818e60..32434d34ed 100644--- a/client/src/views/notification/badge.js+++ b/client/src/views/notification/badge.js@@ -88,7 +88,7 @@ class NotificationBadgeView extends View {* @private* @type {string}*/- soundPath = 'client/sounds/pop_cork'+ soundPath = 'client/sounds/cloud.ogg'/*** @private@@ -108,7 +108,6 @@ class NotificationBadgeView extends View {this.addActionHandler('showNotifications', () => this.showNotifications());this.soundPath = this.getBasePath() + (this.getConfig().get('notificationSound') || this.soundPath);- this.notificationSoundsDisabled = true;this.useWebSocket = this.webSocketManager.isEnabled();const clearTimeouts = () => {@@ -240,34 +239,14 @@ class NotificationBadgeView extends View {}playSound() {- if (this.notificationSoundsDisabled) {+ if (!this.getPreferences().get('notificationSound')) {return;}- const audioElement =- /** @type {HTMLAudioElement} */$('<audio>')- .attr('autoplay', 'autoplay')- .append(- $('<source>')- .attr('src', this.soundPath + '.mp3')- .attr('type', 'audio/mpeg')- )- .append(- $('<source>')- .attr('src', this.soundPath + '.ogg')- .attr('type', 'audio/ogg')- )- .append(- $('<embed>')- .attr('src', this.soundPath + '.mp3')- .attr('hidden', 'true')- .attr('autostart', 'true')- .attr('false', 'false')- )- .get(0);-- audioElement.volume = 0.3;- audioElement.play();+ const audio = new Audio(this.soundPath);+ audio.volume = 0.3;++ audio.play();}/**diff --git a/client/src/views/popup-notification.js b/client/src/views/popup-notification.jsindex 2c452beb3f..8156227ce8 100644--- a/client/src/views/popup-notification.js+++ b/client/src/views/popup-notification.js@@ -59,7 +59,7 @@ class PopupNotificationView extends View {*/isCollapsed = false- soundPath = 'client/sounds/pop_cork'+ soundPath = 'client/sounds/cloud.ogg'/*** @param {{@@ -85,8 +85,6 @@ class PopupNotificationView extends View {this.setSelector(containerSelector);- this.notificationSoundsDisabled = this.getConfig().get('notificationSoundsDisabled');-this.soundPath = this.getBasePath() +(this.getConfig().get('popupNotificationSound') || this.soundPath);@@ -154,22 +152,14 @@ class PopupNotificationView extends View {}playSound() {- if (this.notificationSoundsDisabled) {+ if (!this.getPreferences().get('notificationSound')) {return;}- const html =- '<audio autoplay="autoplay">' +- '<source src="' + this.soundPath + '.mp3" type="audio/mpeg" />' +- '<source src="' + this.soundPath + '.ogg" type="audio/ogg" />' +- '<embed hidden="true" autostart="true" loop="false" src="' + this.soundPath + '.mp3" />' +- '</audio>';-- const $audio = $(html);+ const audio = new Audio(this.soundPath);+ audio.volume = 0.3;- $audio.get(0).volume = 0.3;- // noinspection JSUnresolvedReference- $audio.get(0).play();+ audio.play();}/**