From c56b41bf4701a66cfa5c8c07163fbbfa606d35d6 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Fri, 26 Oct 2018 11:35:47 -0500 Subject: [PATCH] add SoundNotifications toggle.conf --- src/client/spark/Notifications/INotifier.cs | 20 ++++++++++++-------- src/lib/config/protos/toggles.proto | 4 ++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/client/spark/Notifications/INotifier.cs b/src/client/spark/Notifications/INotifier.cs index 37f1f25ab..296154b18 100644 --- a/src/client/spark/Notifications/INotifier.cs +++ b/src/client/spark/Notifications/INotifier.cs @@ -53,18 +53,22 @@ namespace mbts.ui { ToastNotificationController _toast_controller; SoundNotificationPlayer _sound_player; Dispatcher _dispatcher; - bool _toast_notifications_enabled, _sound_notifications_enabled = NotificationSettings.Default.sound_notification.enabled; + bool + _sound_notifications_enabled = Configuration.get().enabled, + _toast_notifications_enabled = Configuration.get().enabled; [ImportingConstructor] public Notifier(IBus bus, UserSettingsHub settings_hub) { _disposer = new ThreadSafeDisposable(dispose_core); - Thread thread = new Thread(start) { - IsBackground = true, - Priority = ThreadPriority.BelowNormal, - Name = "BTSNotifications" - }; - thread.SetApartmentState(ApartmentState.STA); - thread.Start(); + if (_sound_notifications_enabled || _toast_notifications_enabled) { + Thread thread = new Thread(start) { + IsBackground = true, + Priority = ThreadPriority.BelowNormal, + Name = "BTSNotifications" + }; + thread.SetApartmentState(ApartmentState.STA); + thread.Start(); + } void start() { try { diff --git a/src/lib/config/protos/toggles.proto b/src/lib/config/protos/toggles.proto index d940fa416..5e1fbd736 100644 --- a/src/lib/config/protos/toggles.proto +++ b/src/lib/config/protos/toggles.proto @@ -28,6 +28,10 @@ message ToastNotifications { optional bool enabled = 1 [default = false]; } +message SoundNotifications { + optional bool enabled = 1 [default = true]; +} + message VolumeAtPrice{ optional bool enabled = 1 [default = true]; } \ No newline at end of file