summaryrefslogtreecommitdiff
path: root/flow-mvi/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'flow-mvi/src/main/java')
-rw-r--r--flow-mvi/src/main/java/foundation/e/flowmvi/feature/BaseFeature.kt18
1 files changed, 2 insertions, 16 deletions
diff --git a/flow-mvi/src/main/java/foundation/e/flowmvi/feature/BaseFeature.kt b/flow-mvi/src/main/java/foundation/e/flowmvi/feature/BaseFeature.kt
index c60373f..1429d1a 100644
--- a/flow-mvi/src/main/java/foundation/e/flowmvi/feature/BaseFeature.kt
+++ b/flow-mvi/src/main/java/foundation/e/flowmvi/feature/BaseFeature.kt
@@ -31,7 +31,6 @@ import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.emitAll
import kotlinx.coroutines.flow.launchIn
-import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.receiveAsFlow
@@ -72,17 +71,10 @@ open class BaseFeature<State : Any, in Action : Any, in Effect : Any, SingleEven
private fun sendStateUpdatesIntoView(
callerCoroutineScope: CoroutineScope,
view: MVIView<State, Action>,
- logger: Logger
+ @Suppress("UNUSED_PARAMETER") logger: Logger
) {
state
- .onStart {
- logger.invoke("State flow started")
- }
- .onCompletion {
- logger.invoke("State flow completed")
- }
.onEach {
- logger.invoke("New state: $it")
view.render(it)
}
.launchIn(callerCoroutineScope)
@@ -98,12 +90,8 @@ open class BaseFeature<State : Any, in Action : Any, in Effect : Any, SingleEven
view
.actions()
.onStart {
- logger.invoke("View actions flow started")
emitAll(initialActions.asFlow())
}
- .onCompletion { cause ->
- logger.invoke("View actions flow completed: $cause")
- }
.collectIntoHandler(this, logger)
}
}
@@ -116,15 +104,13 @@ open class BaseFeature<State : Any, in Action : Any, in Effect : Any, SingleEven
private suspend fun Flow<Action>.collectIntoHandler(
callerCoroutineScope: CoroutineScope,
- logger: Logger
+ @Suppress("UNUSED_PARAMETER") logger: Logger
) {
onEach { action ->
callerCoroutineScope.launch {
- logger.invoke("Received action $action $this")
actor.invoke(_state.value, action)
.onEach { effect ->
mutex.withLock {
- logger.invoke("Applying effect $effect from action $action")
val newState = reducer.invoke(_state.value, effect)
_state.value = newState
singleEventProducer?.also {