From 6853399876d274c105691eb7ba41bbcec9a6bdd1 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Thu, 22 Dec 2022 20:18:53 -0500 Subject: [PATCH] Clean up app version check for activeNotifications in NotificationReceiver --- .../data/notification/NotificationReceiver.kt | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt index a83b876bc5..9dc2980d84 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt @@ -6,7 +6,6 @@ import android.content.ClipData import android.content.Context import android.content.Intent import android.net.Uri -import android.os.Build import android.os.Handler import eu.kanade.tachiyomi.data.backup.BackupRestoreService import eu.kanade.tachiyomi.data.database.DatabaseHelper @@ -350,18 +349,16 @@ class NotificationReceiver : BroadcastReceiver() { groupId: Int? = null, ) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - val groupKey = context.notificationManager.activeNotifications.find { - it.id == notificationId - }?.groupKey - if (groupId != null && groupId != 0 && groupKey != null && groupKey.isNotEmpty()) { - val notifications = context.notificationManager.activeNotifications.filter { - it.groupKey == groupKey - } - if (notifications.size == 2) { - context.notificationManager.cancel(groupId) - return - } + val groupKey = context.notificationManager.activeNotifications.find { + it.id == notificationId + }?.groupKey + if (groupId != null && groupId != 0 && groupKey != null && groupKey.isNotEmpty()) { + val notifications = context.notificationManager.activeNotifications.filter { + it.groupKey == groupKey + } + if (notifications.size == 2) { + context.notificationManager.cancel(groupId) + return } } context.notificationManager.cancel(notificationId)