Remove unused method ActiveNotificationsProvider.getAllNotifications()
This commit is contained in:
@@ -26,7 +26,6 @@ import io.element.android.libraries.push.api.notifications.NotificationIdProvide
|
||||
import javax.inject.Inject
|
||||
|
||||
interface ActiveNotificationsProvider {
|
||||
fun getAllNotifications(): List<StatusBarNotification>
|
||||
fun getMessageNotificationsForRoom(sessionId: SessionId, roomId: RoomId): List<StatusBarNotification>
|
||||
fun getNotificationsForSession(sessionId: SessionId): List<StatusBarNotification>
|
||||
fun getMembershipNotificationForSession(sessionId: SessionId): List<StatusBarNotification>
|
||||
@@ -39,10 +38,6 @@ interface ActiveNotificationsProvider {
|
||||
class DefaultActiveNotificationsProvider @Inject constructor(
|
||||
private val notificationManager: NotificationManagerCompat,
|
||||
) : ActiveNotificationsProvider {
|
||||
override fun getAllNotifications(): List<StatusBarNotification> {
|
||||
return notificationManager.activeNotifications
|
||||
}
|
||||
|
||||
override fun getNotificationsForSession(sessionId: SessionId): List<StatusBarNotification> {
|
||||
return notificationManager.activeNotifications.filter { it.notification.group == sessionId.value }
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -24,10 +24,6 @@ import io.element.android.libraries.push.impl.notifications.ActiveNotificationsP
|
||||
class FakeActiveNotificationsProvider(
|
||||
var activeNotifications: MutableList<StatusBarNotification> = mutableListOf(),
|
||||
) : ActiveNotificationsProvider {
|
||||
override fun getAllNotifications(): List<StatusBarNotification> {
|
||||
return activeNotifications
|
||||
}
|
||||
|
||||
override fun getMessageNotificationsForRoom(sessionId: SessionId, roomId: RoomId): List<StatusBarNotification> {
|
||||
return activeNotifications
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user