diff --git a/Dialogs/FormSettings.cs b/Dialogs/FormSettings.cs index a16a0415..368eab3d 100644 --- a/Dialogs/FormSettings.cs +++ b/Dialogs/FormSettings.cs @@ -42,7 +42,7 @@ public FormSettings(FormBrowser browser, PluginManager plugins, UpdateChecker up AddButton("General", () => new TabSettingsGeneral(tweetDeckFunctions.ReloadColumns, updates)); AddButton("Notifications", () => new TabSettingsNotifications(this.browser.CreateExampleNotification())); - AddButton("Sounds", () => new TabSettingsSounds(tweetDeckFunctions.PlaySoundNotification)); + AddButton("Sounds", () => new TabSettingsSounds(() => tweetDeckFunctions.PlaySoundNotification(true))); AddButton("Tray", () => new TabSettingsTray()); AddButton("Feedback", () => new TabSettingsFeedback()); AddButton("Advanced", () => new TabSettingsAdvanced(tweetDeckFunctions.ReinjectCustomCSS, this.browser.OpenDevTools)); diff --git a/Resources/Content/tweetdeck/setup_sound_notifications.js b/Resources/Content/tweetdeck/setup_sound_notifications.js index 6cd76364..06474226 100644 --- a/Resources/Content/tweetdeck/setup_sound_notifications.js +++ b/Resources/Content/tweetdeck/setup_sound_notifications.js @@ -31,12 +31,16 @@ export default function() { audio.load(); }; - window.TDGF_playSoundNotification = function() { + let forcePlayNotification = false; + + window.TDGF_playSoundNotification = function(force) { + forcePlayNotification = force; document.getElementById("update-sound").play(); + forcePlayNotification = false; }; replaceFunction(HTMLAudioElement.prototype, "play", function(func, args) { - if (!$TDX.muteNotifications && isAppReady()) { + if ((!$TDX.muteNotifications || forcePlayNotification) && isAppReady()) { func.apply(this, args); } }); diff --git a/lib/TweetLib.Core/Features/TweetDeck/TweetDeckFunctions.cs b/lib/TweetLib.Core/Features/TweetDeck/TweetDeckFunctions.cs index 25e83dfd..4f80fa69 100644 --- a/lib/TweetLib.Core/Features/TweetDeck/TweetDeckFunctions.cs +++ b/lib/TweetLib.Core/Features/TweetDeck/TweetDeckFunctions.cs @@ -35,8 +35,8 @@ public void ReloadColumns() { executor.RunFunction("TDGF_reloadColumns"); } - public void PlaySoundNotification() { - executor.RunFunction("TDGF_playSoundNotification"); + public void PlaySoundNotification(bool force) { + executor.RunFunction("TDGF_playSoundNotification", force); } public void ApplyROT13() {