From 5a84103ea42b1fe24d01db30890e0e70623ae81e Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Tue, 5 Nov 2024 19:44:00 +0100 Subject: [PATCH] chore: fix code review --- .../commonMain/kotlin/pro/respawn/flowmvi/StoreImpl.kt | 2 +- .../kotlin/pro/respawn/flowmvi/modules/PipelineModule.kt | 8 ++++---- gradle/libs.versions.toml | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/src/commonMain/kotlin/pro/respawn/flowmvi/StoreImpl.kt b/core/src/commonMain/kotlin/pro/respawn/flowmvi/StoreImpl.kt index 06df3d12..ad936765 100644 --- a/core/src/commonMain/kotlin/pro/respawn/flowmvi/StoreImpl.kt +++ b/core/src/commonMain/kotlin/pro/respawn/flowmvi/StoreImpl.kt @@ -52,7 +52,7 @@ internal class StoreImpl( override fun start(scope: CoroutineScope) = launchPipeline( parent = scope, - config = config, + storeConfig = config, onAction = { action -> onAction(action)?.let { this@StoreImpl.action(it) } }, onTransformState = { transform -> this@StoreImpl.updateState { onState(this, transform()) ?: this } diff --git a/core/src/commonMain/kotlin/pro/respawn/flowmvi/modules/PipelineModule.kt b/core/src/commonMain/kotlin/pro/respawn/flowmvi/modules/PipelineModule.kt index 49f89276..ad809c94 100644 --- a/core/src/commonMain/kotlin/pro/respawn/flowmvi/modules/PipelineModule.kt +++ b/core/src/commonMain/kotlin/pro/respawn/flowmvi/modules/PipelineModule.kt @@ -32,7 +32,7 @@ import pro.respawn.flowmvi.api.lifecycle.StoreLifecycle @OptIn(DelicateStoreApi::class) internal inline fun T.launchPipeline( parent: CoroutineScope, - config: StoreConfiguration, + storeConfig: StoreConfiguration, crossinline onStop: (e: Exception?) -> Unit, crossinline onAction: suspend PipelineContext.(action: A) -> Unit, crossinline onTransformState: suspend PipelineContext.(transform: suspend S.() -> S) -> Unit, @@ -54,19 +54,19 @@ internal inline fun T.launchPipe StoreLifecycleModule by storeLifecycle(job), ActionReceiver { - override val config get() = config + override val config = storeConfig override val key = PipelineContext // recoverable should be separate from this key private val handler = PipelineExceptionHandler() private val pipelineName = CoroutineName(toString()) override val coroutineContext = parent.coroutineContext + - config.coroutineContext + + storeConfig.coroutineContext + pipelineName + job + handler + this - override fun toString(): String = "${config.name.orEmpty()}PipelineContext" + override fun toString(): String = "${storeConfig.name.orEmpty()}PipelineContext" override suspend fun updateState(transform: suspend S.() -> S) = catch { onTransformState(transform) } override suspend fun action(action: A) = catch { onAction(action) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5a422009..e3ada66a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,7 +23,9 @@ kotlin-io = "0.5.4" kotlinx-atomicfu = "0.26.0" ktor = "3.0.1" lifecycle = "2.8.3" -androidx-lifecycle = "2.8.7" +# @pin +#noinspection GradleDependency - must match jb-lifecycle +androidx-lifecycle = "2.8.3" maven-publish-plugin = "0.30.0" serialization = "1.7.3" turbine = "1.2.0"