inlining single use extension functions
This commit is contained in:
parent
86ce6a404e
commit
4748a385ea
|
@ -86,9 +86,9 @@ class NotificationFactory @Inject constructor(
|
||||||
invitationNotifications: List<OneShotNotification>,
|
invitationNotifications: List<OneShotNotification>,
|
||||||
simpleNotifications: List<OneShotNotification>,
|
simpleNotifications: List<OneShotNotification>,
|
||||||
useCompleteNotificationFormat: Boolean): SummaryNotification {
|
useCompleteNotificationFormat: Boolean): SummaryNotification {
|
||||||
val roomMeta = roomNotifications.mapToMeta()
|
val roomMeta = roomNotifications.filterIsInstance<RoomNotification.Message>().map { it.meta }
|
||||||
val invitationMeta = invitationNotifications.mapToMeta()
|
val invitationMeta = invitationNotifications.filterIsInstance<OneShotNotification.Append>().map { it.meta }
|
||||||
val simpleMeta = simpleNotifications.mapToMeta()
|
val simpleMeta = simpleNotifications.filterIsInstance<OneShotNotification.Append>().map { it.meta }
|
||||||
return when {
|
return when {
|
||||||
roomMeta.isEmpty() && invitationMeta.isEmpty() && simpleMeta.isEmpty() -> SummaryNotification.Removed
|
roomMeta.isEmpty() && invitationMeta.isEmpty() && simpleMeta.isEmpty() -> SummaryNotification.Removed
|
||||||
else -> SummaryNotification.Update(
|
else -> SummaryNotification.Update(
|
||||||
|
@ -102,11 +102,6 @@ class NotificationFactory @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun List<RoomNotification>.mapToMeta() = filterIsInstance<RoomNotification.Message>().map { it.meta }
|
|
||||||
|
|
||||||
@JvmName("mapToMetaOneShotNotification")
|
|
||||||
private fun List<OneShotNotification>.mapToMeta() = filterIsInstance<OneShotNotification.Append>().map { it.meta }
|
|
||||||
|
|
||||||
sealed interface RoomNotification {
|
sealed interface RoomNotification {
|
||||||
data class Removed(val roomId: String) : RoomNotification
|
data class Removed(val roomId: String) : RoomNotification
|
||||||
data class Message(val notification: Notification, val shortcutInfo: ShortcutInfoCompat?, val meta: Meta) : RoomNotification {
|
data class Message(val notification: Notification, val shortcutInfo: ShortcutInfoCompat?, val meta: Meta) : RoomNotification {
|
||||||
|
|
Loading…
Reference in New Issue