summaryrefslogtreecommitdiff
path: root/flow-mvi/src/main/java
diff options
context:
space:
mode:
authorAlexandre Roux <alexandre.roux.danzi@lostpod.me>2022-06-23 16:02:11 +0000
committerAlexandre Roux <alexandre.roux.danzi@lostpod.me>2022-06-23 16:02:11 +0000
commitb6314aa94aa1c0e3b08e9876bfa959314753104d (patch)
tree0792edd0c06195d993a91fe36ad009627c547596 /flow-mvi/src/main/java
parent0cacbaa0177b03b8d313e051196ef399fea7c34d (diff)
parente2157f3aebf1287a77705c52982ea66f5fbd5237 (diff)
Merge branch 'v1.1-5673-reverting' into 'main'
Revert commits to fix latest version issues See merge request e/os/advanced-privacy!72
Diffstat (limited to 'flow-mvi/src/main/java')
-rw-r--r--flow-mvi/src/main/java/foundation/e/flowmvi/feature/BaseFeature.kt11
1 files changed, 4 insertions, 7 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 e3dd257..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
@@ -23,8 +23,6 @@ import foundation.e.flowmvi.MVIView
import foundation.e.flowmvi.Reducer
import foundation.e.flowmvi.SingleEventProducer
import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
@@ -105,12 +103,11 @@ open class BaseFeature<State : Any, in Action : Any, in Effect : Any, SingleEven
}
private suspend fun Flow<Action>.collectIntoHandler(
- @Suppress("UNUSED_PARAMETER")callerCoroutineScope: CoroutineScope,
+ callerCoroutineScope: CoroutineScope,
@Suppress("UNUSED_PARAMETER") logger: Logger
) {
- val scope = CoroutineScope(Dispatchers.IO + Job())
onEach { action ->
- scope.launch {
+ callerCoroutineScope.launch {
actor.invoke(_state.value, action)
.onEach { effect ->
mutex.withLock {
@@ -125,9 +122,9 @@ open class BaseFeature<State : Any, in Action : Any, in Effect : Any, SingleEven
}
}
}
- .launchIn(scope)
+ .launchIn(coroutineScope)
}
}
- .launchIn(scope)
+ .launchIn(callerCoroutineScope)
}
}