Remove unused method ActiveNotificationsProvider.getAllNotifications()
This commit is contained in:
parent
3b12d54dad
commit
0037552f77
3 changed files with 0 additions and 30 deletions
|
|
@ -26,7 +26,6 @@ import io.element.android.libraries.push.api.notifications.NotificationIdProvide
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
interface ActiveNotificationsProvider {
|
interface ActiveNotificationsProvider {
|
||||||
fun getAllNotifications(): List<StatusBarNotification>
|
|
||||||
fun getMessageNotificationsForRoom(sessionId: SessionId, roomId: RoomId): List<StatusBarNotification>
|
fun getMessageNotificationsForRoom(sessionId: SessionId, roomId: RoomId): List<StatusBarNotification>
|
||||||
fun getNotificationsForSession(sessionId: SessionId): List<StatusBarNotification>
|
fun getNotificationsForSession(sessionId: SessionId): List<StatusBarNotification>
|
||||||
fun getMembershipNotificationForSession(sessionId: SessionId): List<StatusBarNotification>
|
fun getMembershipNotificationForSession(sessionId: SessionId): List<StatusBarNotification>
|
||||||
|
|
@ -39,10 +38,6 @@ interface ActiveNotificationsProvider {
|
||||||
class DefaultActiveNotificationsProvider @Inject constructor(
|
class DefaultActiveNotificationsProvider @Inject constructor(
|
||||||
private val notificationManager: NotificationManagerCompat,
|
private val notificationManager: NotificationManagerCompat,
|
||||||
) : ActiveNotificationsProvider {
|
) : ActiveNotificationsProvider {
|
||||||
override fun getAllNotifications(): List<StatusBarNotification> {
|
|
||||||
return notificationManager.activeNotifications
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getNotificationsForSession(sessionId: SessionId): List<StatusBarNotification> {
|
override fun getNotificationsForSession(sessionId: SessionId): List<StatusBarNotification> {
|
||||||
return notificationManager.activeNotifications.filter { it.notification.group == sessionId.value }
|
return notificationManager.activeNotifications.filter { it.notification.group == sessionId.value }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,27 +36,6 @@ import org.robolectric.RobolectricTestRunner
|
||||||
class DefaultActiveNotificationsProviderTest {
|
class DefaultActiveNotificationsProviderTest {
|
||||||
private val notificationIdProvider = NotificationIdProvider
|
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
|
@Test
|
||||||
fun `getNotificationsForSession returns only notifications for that session id`() {
|
fun `getNotificationsForSession returns only notifications for that session id`() {
|
||||||
val activeNotifications = listOf(
|
val activeNotifications = listOf(
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,6 @@ import io.element.android.libraries.push.impl.notifications.ActiveNotificationsP
|
||||||
class FakeActiveNotificationsProvider(
|
class FakeActiveNotificationsProvider(
|
||||||
var activeNotifications: MutableList<StatusBarNotification> = mutableListOf(),
|
var activeNotifications: MutableList<StatusBarNotification> = mutableListOf(),
|
||||||
) : ActiveNotificationsProvider {
|
) : ActiveNotificationsProvider {
|
||||||
override fun getAllNotifications(): List<StatusBarNotification> {
|
|
||||||
return activeNotifications
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getMessageNotificationsForRoom(sessionId: SessionId, roomId: RoomId): List<StatusBarNotification> {
|
override fun getMessageNotificationsForRoom(sessionId: SessionId, roomId: RoomId): List<StatusBarNotification> {
|
||||||
return activeNotifications
|
return activeNotifications
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue