From c1e152dba2e91c8a13e926ade9b869163b564a09 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 5 Aug 2020 11:10:12 +0100 Subject: [PATCH] Decouple Audible notifications from Desktop notifications --- src/Notifier.ts | 3 ++- src/settings/Settings.ts | 2 -- src/settings/controllers/NotificationControllers.ts | 9 --------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Notifier.ts b/src/Notifier.ts index 5d074156a9..6c783a7b33 100644 --- a/src/Notifier.ts +++ b/src/Notifier.ts @@ -279,7 +279,8 @@ export const Notifier = { }, isAudioEnabled: function() { - return this.isEnabled() && SettingsStore.getValue("audioNotificationsEnabled"); + // We don't route Audio via the HTML Notifications API so it is possible regardless of other things + return SettingsStore.getValue("audioNotificationsEnabled"); }, setToolbarHidden: function(hidden: boolean, persistent = true) { diff --git a/src/settings/Settings.ts b/src/settings/Settings.ts index 1989bd7a34..0fd21e1722 100644 --- a/src/settings/Settings.ts +++ b/src/settings/Settings.ts @@ -19,7 +19,6 @@ import { MatrixClient } from 'matrix-js-sdk/src/client'; import { _td } from '../languageHandler'; import { - AudioNotificationsEnabledController, NotificationBodyEnabledController, NotificationsEnabledController, } from "./controllers/NotificationControllers"; @@ -460,7 +459,6 @@ export const SETTINGS: {[setting: string]: ISetting} = { "audioNotificationsEnabled": { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, default: true, - controller: new AudioNotificationsEnabledController(), }, "enableWidgetScreenshots": { supportedLevels: LEVELS_ACCOUNT_SETTINGS, diff --git a/src/settings/controllers/NotificationControllers.ts b/src/settings/controllers/NotificationControllers.ts index fc50af6096..bf5971d02e 100644 --- a/src/settings/controllers/NotificationControllers.ts +++ b/src/settings/controllers/NotificationControllers.ts @@ -79,12 +79,3 @@ export class NotificationBodyEnabledController extends SettingController { return calculatedValue; } } - -export class AudioNotificationsEnabledController extends SettingController { - public getValueOverride(level: SettingLevel, roomId: string, calculatedValue: any): any { - if (!getNotifier().isPossible()) return false; - - // Note: Audio notifications are *not* enabled by default. - return calculatedValue; - } -}