Skip to content

Commit 0cdf875

Browse files
committed
improve notification filtering
1 parent 3397e58 commit 0cdf875

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

feature/notification/src/main/java/sefirah/notification/NotificationService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import android.service.notification.NotificationListenerService
1313
import android.service.notification.StatusBarNotification
1414
import android.text.SpannableString
1515
import android.util.Log
16+
import androidx.core.app.NotificationCompat
1617
import androidx.core.os.bundleOf
1718
import kotlinx.coroutines.CoroutineScope
1819
import kotlinx.coroutines.Dispatchers
@@ -214,6 +215,7 @@ class NotificationService @Inject constructor(
214215
// Check if the notification is ongoing, media-style, or belongs to the 'progress' category
215216
if ((notification.flags and Notification.FLAG_ONGOING_EVENT) != 0
216217
|| (notification.flags and Notification.FLAG_FOREGROUND_SERVICE) != 0
218+
|| (notification.flags and NotificationCompat.FLAG_GROUP_SUMMARY) != 0
217219
|| notification.isMediaStyle()
218220
|| hasProgress) {
219221
return
@@ -341,8 +343,7 @@ class NotificationService @Inject constructor(
341343
notificationType = notificationType
342344
)
343345

344-
if (notificationMessage.appName == "WhatsApp" && notificationMessage.messages?.isEmpty() == true
345-
|| notificationMessage.appName == "Spotify" && notificationMessage.timestamp == "1970-01-01 05:30:00") {
346+
if (notificationMessage.appName == "Spotify" && notificationMessage.timestamp == "1970-01-01 05:30:00") {
346347
Log.d(TAG, "Duplicate notification, ignoring...")
347348
return@launch
348349
}

0 commit comments

Comments
 (0)