From 724891310e711a504f50a860f59ccae3156f49a7 Mon Sep 17 00:00:00 2001 From: Maximillian Leonov Date: Mon, 15 Aug 2022 15:29:54 +0400 Subject: [PATCH] Minor improvements in FlowMapper --- .../mapper/{FlowPagingMapper.kt => FlowMapper.kt} | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) rename core/core-presentation/src/main/kotlin/com/maximillianleonov/cinemax/core/presentation/mapper/{FlowPagingMapper.kt => FlowMapper.kt} (71%) diff --git a/core/core-presentation/src/main/kotlin/com/maximillianleonov/cinemax/core/presentation/mapper/FlowPagingMapper.kt b/core/core-presentation/src/main/kotlin/com/maximillianleonov/cinemax/core/presentation/mapper/FlowMapper.kt similarity index 71% rename from core/core-presentation/src/main/kotlin/com/maximillianleonov/cinemax/core/presentation/mapper/FlowPagingMapper.kt rename to core/core-presentation/src/main/kotlin/com/maximillianleonov/cinemax/core/presentation/mapper/FlowMapper.kt index 8d8d15dc..f41021a9 100644 --- a/core/core-presentation/src/main/kotlin/com/maximillianleonov/cinemax/core/presentation/mapper/FlowPagingMapper.kt +++ b/core/core-presentation/src/main/kotlin/com/maximillianleonov/cinemax/core/presentation/mapper/FlowMapper.kt @@ -22,15 +22,9 @@ import com.maximillianleonov.cinemax.core.presentation.util.MapperFactory import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map -interface FlowPagingMapper { - fun Flow>.pagingMap(): Flow> -} +fun Flow>.pagingDomainMap(): Flow> = + pagingMap(transform = MapperFactory.domainMapper()) -class FlowPagingMapperImpl : FlowPagingMapper { - override fun Flow>.pagingMap(): Flow> = - pagingMap(transform = MapperFactory.domainMapper()) -} - -private fun Flow>.pagingMap( +fun Flow>.pagingMap( transform: (T) -> R ): Flow> = map { it.map(transform) }