summaryrefslogtreecommitdiff
path: root/flow-mvi/src/main/java
diff options
context:
space:
mode:
authorGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2022-02-24 07:46:24 +0000
committerGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2022-02-24 07:46:24 +0000
commit323d28aa26beace64186a33a0557e2e7ad4771af (patch)
tree97446224925c34be4ed09e6d0ce679275f698726 /flow-mvi/src/main/java
parent6abf3b8bbcec463dcea8acbba63872d587ff2779 (diff)
parent650a067529cdf65cc9a9130c91511adfb4b64c98 (diff)
Merge branch 'UX_trackers_updates' into 'main'
Access trackers list when QP disabled: #4591, #4596, #4601 See merge request e/privacy-central/privacycentralapp!17
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 {