From 63d74287dc9e043c4beff5f24b0dbba34e5744aa Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Thu, 14 Jun 2018 01:36:44 +0200
Subject: [PATCH] Correctly implement notification options

---
 .../service/QuasseldroidNotificationManager.kt    | 15 ++++++++++-----
 app/src/main/res/xml/preferences.xml              |  5 +----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/QuasseldroidNotificationManager.kt b/app/src/main/java/de/kuschku/quasseldroid/service/QuasseldroidNotificationManager.kt
index c87b1ab03..6ee03952e 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/service/QuasseldroidNotificationManager.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/service/QuasseldroidNotificationManager.kt
@@ -168,13 +168,18 @@ class QuasseldroidNotificationManager @Inject constructor(private val context: C
       .setColor(context.getColorCompat(R.color.colorPrimary))
       .setLights(context.getColorCompat(R.color.colorPrimary), 200, 200)
       .apply {
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O && isLoud) {
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
           var defaults = 0
-          if (!notificationSettings.sound.isEmpty()) {
-            setSound(Uri.parse(notificationSettings.sound))
+          if (isLoud) {
+            if (!notificationSettings.sound.isEmpty()) {
+              setSound(Uri.parse(notificationSettings.sound))
+            }
+            if (notificationSettings.vibrate) {
+              defaults = defaults or NotificationCompat.DEFAULT_VIBRATE
+            }
           }
-          if (notificationSettings.vibrate) {
-            defaults = defaults or NotificationCompat.DEFAULT_VIBRATE
+          if (notificationSettings.light) {
+            defaults = defaults or NotificationCompat.DEFAULT_LIGHTS
           }
           setDefaults(defaults)
         }
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index 2c21610fe..bf95c06c9 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -98,13 +98,10 @@
     <PreferenceScreen
       android:key="@string/preference_notification_configure_key"
       android:title="@string/preference_notification_configure_title">
-      <intent android:action="android.settings.CHANNEL_NOTIFICATION_SETTINGS">
+      <intent android:action="android.settings.APP_NOTIFICATION_SETTINGS">
         <extra
           android:name="android.provider.extra.APP_PACKAGE"
           android:value="@string/package_name" />
-        <extra
-          android:name="android.provider.extra.CHANNEL_ID"
-          android:value="@string/notification_channel_highlight" />
       </intent>
     </PreferenceScreen>
   </PreferenceCategory>
-- 
GitLab