applying when timestamp to the summary notification
This commit is contained in:
parent
8c1265c957
commit
3bbfd05fce
|
@ -67,9 +67,11 @@ class NotificationFactory(
|
|||
fun createSummary(notifications: List<NotificationTypes.Room>): AndroidNotification {
|
||||
val summaryInboxStyle = notificationStyleFactory.summary(notifications)
|
||||
val openAppIntent = intentFactory.notificationOpenApp(context)
|
||||
val mostRecent = notifications.mostRecent()
|
||||
return AndroidNotification(
|
||||
channelId = notifications.mostRecent().summaryChannelId,
|
||||
channelId = mostRecent.summaryChannelId,
|
||||
messageStyle = summaryInboxStyle,
|
||||
whenTimestamp = mostRecent.notification.whenTimestamp,
|
||||
alertMoreThanOnce = notifications.any { it.isAlerting },
|
||||
smallIcon = R.drawable.ic_notification_small_icon,
|
||||
contentIntent = openAppIntent,
|
||||
|
|
|
@ -60,7 +60,7 @@ class NotificationFactoryTest {
|
|||
|
||||
val result = notificationFactory.createSummary(notifications)
|
||||
|
||||
result shouldBeEqualTo expectedSummary(channelId = A_CHANNEL_ID, shouldAlertMoreThanOnce = true)
|
||||
result shouldBeEqualTo expectedSummary(notifications.first().notification, shouldAlertMoreThanOnce = true)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -76,7 +76,7 @@ class NotificationFactoryTest {
|
|||
|
||||
val result = notificationFactory.createSummary(notifications)
|
||||
|
||||
result shouldBeEqualTo expectedSummary(channelId = A_CHANNEL_ID, shouldAlertMoreThanOnce = false)
|
||||
result shouldBeEqualTo expectedSummary(notifications.first().notification, shouldAlertMoreThanOnce = false)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -158,8 +158,9 @@ class NotificationFactoryTest {
|
|||
summaryChannelId = channel,
|
||||
)
|
||||
|
||||
private fun expectedSummary(channelId: String, shouldAlertMoreThanOnce: Boolean) = AndroidNotification(
|
||||
channelId = channelId,
|
||||
private fun expectedSummary(notification: AndroidNotification, shouldAlertMoreThanOnce: Boolean) = AndroidNotification(
|
||||
channelId = notification.channelId,
|
||||
whenTimestamp = notification.whenTimestamp,
|
||||
messageStyle = A_NOTIFICATION_STYLE,
|
||||
alertMoreThanOnce = shouldAlertMoreThanOnce,
|
||||
smallIcon = R.drawable.ic_notification_small_icon,
|
||||
|
|
Loading…
Reference in New Issue