From 0037552f7779f0422ab5af778c91804f13b80d76 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 28 Aug 2024 10:55:22 +0200 Subject: [PATCH] Remove unused method ActiveNotificationsProvider.getAllNotifications() --- .../ActiveNotificationsProvider.kt | 5 ----- .../DefaultActiveNotificationsProviderTest.kt | 21 ------------------- .../fake/FakeActiveNotificationsProvider.kt | 4 ---- 3 files changed, 30 deletions(-) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/ActiveNotificationsProvider.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/ActiveNotificationsProvider.kt index 01b9837f3b..c742c375d4 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/ActiveNotificationsProvider.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/ActiveNotificationsProvider.kt @@ -26,7 +26,6 @@ import io.element.android.libraries.push.api.notifications.NotificationIdProvide import javax.inject.Inject interface ActiveNotificationsProvider { - fun getAllNotifications(): List fun getMessageNotificationsForRoom(sessionId: SessionId, roomId: RoomId): List fun getNotificationsForSession(sessionId: SessionId): List fun getMembershipNotificationForSession(sessionId: SessionId): List @@ -39,10 +38,6 @@ interface ActiveNotificationsProvider { class DefaultActiveNotificationsProvider @Inject constructor( private val notificationManager: NotificationManagerCompat, ) : ActiveNotificationsProvider { - override fun getAllNotifications(): List { - return notificationManager.activeNotifications - } - override fun getNotificationsForSession(sessionId: SessionId): List { return notificationManager.activeNotifications.filter { it.notification.group == sessionId.value } } diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultActiveNotificationsProviderTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultActiveNotificationsProviderTest.kt index 70403e1986..04c2a38a34 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultActiveNotificationsProviderTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultActiveNotificationsProviderTest.kt @@ -36,27 +36,6 @@ import org.robolectric.RobolectricTestRunner class DefaultActiveNotificationsProviderTest { private val notificationIdProvider = NotificationIdProvider - @Test - fun `getAllNotifications with no active notifications returns empty list`() { - val activeNotificationsProvider = createActiveNotificationsProvider(activeNotifications = emptyList()) - - val emptyNotifications = activeNotificationsProvider.getAllNotifications() - assertThat(emptyNotifications).isEmpty() - } - - @Test - fun `getAllNotifications with active notifications returns all`() { - val activeNotifications = listOf( - aStatusBarNotification(id = notificationIdProvider.getRoomMessagesNotificationId(A_SESSION_ID), groupId = A_SESSION_ID.value), - aStatusBarNotification(id = notificationIdProvider.getSummaryNotificationId(A_SESSION_ID), groupId = A_SESSION_ID.value), - aStatusBarNotification(id = notificationIdProvider.getRoomInvitationNotificationId(A_SESSION_ID), groupId = A_SESSION_ID.value), - ) - val activeNotificationsProvider = createActiveNotificationsProvider(activeNotifications = activeNotifications) - - val result = activeNotificationsProvider.getAllNotifications() - assertThat(result).hasSize(3) - } - @Test fun `getNotificationsForSession returns only notifications for that session id`() { val activeNotifications = listOf( diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeActiveNotificationsProvider.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeActiveNotificationsProvider.kt index 680688d3dc..a5d306842f 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeActiveNotificationsProvider.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeActiveNotificationsProvider.kt @@ -24,10 +24,6 @@ import io.element.android.libraries.push.impl.notifications.ActiveNotificationsP class FakeActiveNotificationsProvider( var activeNotifications: MutableList = mutableListOf(), ) : ActiveNotificationsProvider { - override fun getAllNotifications(): List { - return activeNotifications - } - override fun getMessageNotificationsForRoom(sessionId: SessionId, roomId: RoomId): List { return activeNotifications }