Browse Source

Remove usage of `with(notificationDataFactory)` for code clarity.

pull/3320/head
Benoit Marty 1 month ago committed by Benoit Marty
parent
commit
19bca0775a
  1. 12
      libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationRenderer.kt

12
libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationRenderer.kt

@ -42,12 +42,11 @@ class NotificationRenderer @Inject constructor(
imageLoader: ImageLoader, imageLoader: ImageLoader,
) { ) {
val groupedEvents = eventsToProcess.groupByType() val groupedEvents = eventsToProcess.groupByType()
with(notificationDataFactory) { val roomNotifications = notificationDataFactory.toNotifications(groupedEvents.roomEvents, currentUser, imageLoader)
val roomNotifications = toNotifications(groupedEvents.roomEvents, currentUser, imageLoader) val invitationNotifications = notificationDataFactory.toNotifications(groupedEvents.invitationEvents)
val invitationNotifications = toNotifications(groupedEvents.invitationEvents) val simpleNotifications = notificationDataFactory.toNotifications(groupedEvents.simpleEvents)
val simpleNotifications = toNotifications(groupedEvents.simpleEvents) val fallbackNotifications = notificationDataFactory.toNotifications(groupedEvents.fallbackEvents)
val fallbackNotifications = toNotifications(groupedEvents.fallbackEvents) val summaryNotification = notificationDataFactory.createSummaryNotification(
val summaryNotification = createSummaryNotification(
currentUser = currentUser, currentUser = currentUser,
roomNotifications = roomNotifications, roomNotifications = roomNotifications,
invitationNotifications = invitationNotifications, invitationNotifications = invitationNotifications,
@ -115,7 +114,6 @@ class NotificationRenderer @Inject constructor(
} }
} }
} }
}
private fun List<NotifiableEvent>.groupByType(): GroupedNotificationEvents { private fun List<NotifiableEvent>.groupByType(): GroupedNotificationEvents {
val roomEvents: MutableList<NotifiableMessageEvent> = mutableListOf() val roomEvents: MutableList<NotifiableMessageEvent> = mutableListOf()

Loading…
Cancel
Save