From dcbb045bcd379fe7917dc1bc8140bb6e387f12e5 Mon Sep 17 00:00:00 2001 From: iamsivin Date: Wed, 12 Jun 2024 18:01:56 +0530 Subject: [PATCH] fix: Audio notification instance not updating in realtime --- .../DashboardAudioNotificationHelper.js | 12 +++++++++ .../dashboard/helper/scriptHelpers.js | 2 +- .../settings/profile/AudioNotifications.vue | 20 +++++++++++++++ .../profile/NotificationPreferences.vue | 25 ------------------- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js b/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js index 724fd18cf..d591fd1cf 100644 --- a/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js +++ b/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js @@ -36,6 +36,18 @@ class DashboardAudioNotificationHelper { initFaviconSwitcher(); }; + updateInstanceValues = ({ + alwaysPlayAudioAlert, + alertIfUnreadConversationExist, + audioAlertType, + audioAlertTone, + }) => { + this.audioAlertType = audioAlertType; + this.playAlertOnlyWhenHidden = !alwaysPlayAudioAlert; + this.alertIfUnreadConversationExist = alertIfUnreadConversationExist; + this.audioAlertTone = audioAlertTone; + }; + onAudioListenEvent = async () => { try { await getAlertAudio('', { diff --git a/app/javascript/dashboard/helper/scriptHelpers.js b/app/javascript/dashboard/helper/scriptHelpers.js index 292751a94..696320171 100644 --- a/app/javascript/dashboard/helper/scriptHelpers.js +++ b/app/javascript/dashboard/helper/scriptHelpers.js @@ -21,7 +21,7 @@ const initializeAudioAlerts = user => { enable_audio_alerts: audioAlertType, alert_if_unread_assigned_conversation_exist: alertIfUnreadConversationExist, notification_tone: audioAlertTone, - // UI Settings can be undefined initally as we don't send the + // UI Settings can be undefined initially as we don't send the // entire payload for the user during the signup process. } = uiSettings || {}; diff --git a/app/javascript/dashboard/routes/dashboard/settings/profile/AudioNotifications.vue b/app/javascript/dashboard/routes/dashboard/settings/profile/AudioNotifications.vue index 84f369f5a..22cc40ec6 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/profile/AudioNotifications.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/profile/AudioNotifications.vue @@ -30,6 +30,7 @@