File tree Expand file tree Collapse file tree 2 files changed +2
-3
lines changed
data/src/main/java/com/hoc/flowmvi/data
feature-main/src/main/java/com/hoc/flowmvi/ui/main Expand file tree Collapse file tree 2 files changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import com.hoc.flowmvi.data.remote.UserApiService
7
7
import com.hoc.flowmvi.domain.repository.UserRepository
8
8
import com.squareup.moshi.Moshi
9
9
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
10
- import java.util.concurrent.TimeUnit
11
10
import kotlinx.coroutines.ExperimentalCoroutinesApi
12
11
import kotlinx.coroutines.FlowPreview
13
12
import okhttp3.OkHttpClient
@@ -17,6 +16,7 @@ import org.koin.core.qualifier.named
17
16
import org.koin.dsl.module
18
17
import retrofit2.Retrofit
19
18
import retrofit2.converter.moshi.MoshiConverterFactory
19
+ import java.util.concurrent.TimeUnit
20
20
import kotlin.time.ExperimentalTime
21
21
22
22
private const val BASE_URL = " BASE_URL"
Original file line number Diff line number Diff line change @@ -55,7 +55,6 @@ internal class MainVM(
55
55
_intentFlow .filterIsInstance<ViewIntent .Initial >().take(1 ),
56
56
_intentFlow .filterNot { it is ViewIntent .Initial }
57
57
)
58
- .shareIn(viewModelScope, SharingStarted .WhileSubscribed ())
59
58
.toPartialChangeFlow()
60
59
.sendSingleEvent()
61
60
.scan(initialVS) { vs, change -> change.reduce(vs) }
@@ -86,7 +85,7 @@ internal class MainVM(
86
85
}
87
86
}
88
87
89
- private fun Flow<ViewIntent>.toPartialChangeFlow (): Flow <PartialChange > {
88
+ private fun Flow<ViewIntent>.toPartialChangeFlow (): Flow <PartialChange > = shareIn(viewModelScope, SharingStarted . WhileSubscribed ()). run {
90
89
val getUserChanges = getUsersUseCase()
91
90
.onEach { Log .d(" ###" , " [MAIN_VM] Emit users.size=${it.size} " ) }
92
91
.map {
You can’t perform that action at this time.
0 commit comments