diff --git a/core/src/commonMain/kotlin/ksm/StateController.kt b/core/src/commonMain/kotlin/ksm/StateController.kt index 3c6fa26..345001a 100644 --- a/core/src/commonMain/kotlin/ksm/StateController.kt +++ b/core/src/commonMain/kotlin/ksm/StateController.kt @@ -3,7 +3,7 @@ package ksm import ksm.annotation.LibraryConstructor import ksm.builder.StateControllerBuilder import ksm.context.StateContext -import ksm.context.configuration.plugin.ConfigurationPlugin +import ksm.configuration.plugin.ConfigurationPlugin import ksm.context.finish import ksm.finish.once.plugin.FinishOncePlugin import ksm.lifecycle.plugin.LifecyclePlugin diff --git a/core/src/commonMain/kotlin/ksm/configuration/interceptor/CombinedConfigurationInterceptor.kt b/core/src/commonMain/kotlin/ksm/configuration/interceptor/CombinedConfigurationInterceptor.kt new file mode 100644 index 0000000..b72f410 --- /dev/null +++ b/core/src/commonMain/kotlin/ksm/configuration/interceptor/CombinedConfigurationInterceptor.kt @@ -0,0 +1,17 @@ +package ksm.configuration.interceptor + +import ksm.annotation.MutateContext +import ksm.context.StateContext + +internal class CombinedConfigurationInterceptor( + private val first: ConfigurationInterceptor?, + private val second: ConfigurationInterceptor +) : ConfigurationInterceptor { + @MutateContext + override fun onConfigure(context: StateContext): StateContext { + var applied = context + applied = first?.onConfigure(applied) ?: applied + applied = second.onConfigure(applied) + return applied + } +} diff --git a/core/src/commonMain/kotlin/ksm/configuration/interceptor/ConfigurationInterceptor.kt b/core/src/commonMain/kotlin/ksm/configuration/interceptor/ConfigurationInterceptor.kt new file mode 100644 index 0000000..9f4f98e --- /dev/null +++ b/core/src/commonMain/kotlin/ksm/configuration/interceptor/ConfigurationInterceptor.kt @@ -0,0 +1,16 @@ +package ksm.configuration.interceptor + +import ksm.annotation.MutateContext +import ksm.context.StateContext + +public fun interface ConfigurationInterceptor { + @MutateContext + public fun onConfigure(context: StateContext): StateContext +} + +public operator fun ConfigurationInterceptor?.plus(other: ConfigurationInterceptor): ConfigurationInterceptor { + return CombinedConfigurationInterceptor( + first = this, + second = other + ) +} diff --git a/core/src/commonMain/kotlin/ksm/context/configuration/interceptor/StateContext.kt b/core/src/commonMain/kotlin/ksm/configuration/interceptor/StateContext.kt similarity index 72% rename from core/src/commonMain/kotlin/ksm/context/configuration/interceptor/StateContext.kt rename to core/src/commonMain/kotlin/ksm/configuration/interceptor/StateContext.kt index 0fb080b..c840613 100644 --- a/core/src/commonMain/kotlin/ksm/context/configuration/interceptor/StateContext.kt +++ b/core/src/commonMain/kotlin/ksm/configuration/interceptor/StateContext.kt @@ -1,7 +1,7 @@ -package ksm.context.configuration.interceptor +package ksm.configuration.interceptor import ksm.context.StateContext -import ksm.context.configuration.plugin.ConfigurationPlugin +import ksm.configuration.plugin.ConfigurationPlugin import ksm.plugin.plugin public fun StateContext.addConfigurationInterceptor(interceptor: ConfigurationInterceptor) { diff --git a/core/src/commonMain/kotlin/ksm/context/configuration/plugin/ConfigurationPlugin.kt b/core/src/commonMain/kotlin/ksm/configuration/plugin/ConfigurationPlugin.kt similarity index 61% rename from core/src/commonMain/kotlin/ksm/context/configuration/plugin/ConfigurationPlugin.kt rename to core/src/commonMain/kotlin/ksm/configuration/plugin/ConfigurationPlugin.kt index 9edbabb..7c9a343 100644 --- a/core/src/commonMain/kotlin/ksm/context/configuration/plugin/ConfigurationPlugin.kt +++ b/core/src/commonMain/kotlin/ksm/configuration/plugin/ConfigurationPlugin.kt @@ -1,8 +1,9 @@ -package ksm.context.configuration.plugin +package ksm.configuration.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.plus import ksm.plugin.Plugin public object ConfigurationPlugin : Plugin.Singleton { @@ -16,11 +17,13 @@ public object ConfigurationPlugin : Plugin.Singleton { context: StateContext, interceptor: ConfigurationInterceptor ) { - context.require(ConfigurationStateController).addInterceptor(interceptor) + context.require(ConfigurationStateController).interceptor += interceptor } @MutateContext public fun onConfigure(context: StateContext): StateContext { - return context.require(ConfigurationStateController).onConfigure(context) + return context.require(ConfigurationStateController) + .interceptor?.onConfigure(context) + ?: context } } diff --git a/core/src/commonMain/kotlin/ksm/configuration/plugin/ConfigurationStateController.kt b/core/src/commonMain/kotlin/ksm/configuration/plugin/ConfigurationStateController.kt new file mode 100644 index 0000000..52d66f2 --- /dev/null +++ b/core/src/commonMain/kotlin/ksm/configuration/plugin/ConfigurationStateController.kt @@ -0,0 +1,12 @@ +package ksm.configuration.plugin + +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.context.StateContext + +internal class ConfigurationStateController : StateContext.Element { + override val key = ConfigurationStateController + + var interceptor: ConfigurationInterceptor? = null + + companion object : StateContext.Key +} diff --git a/core/src/commonMain/kotlin/ksm/context/CreateChildStateContext.kt b/core/src/commonMain/kotlin/ksm/context/CreateChildStateContext.kt index 92677ad..832e11b 100644 --- a/core/src/commonMain/kotlin/ksm/context/CreateChildStateContext.kt +++ b/core/src/commonMain/kotlin/ksm/context/CreateChildStateContext.kt @@ -1,16 +1,20 @@ package ksm.context import ksm.annotation.MutateContext -import ksm.context.configuration.plugin.ConfigurationPlugin +import ksm.configuration.plugin.ConfigurationPlugin import ksm.lifecycle.plugin.LifecyclePlugin @OptIn(MutateContext::class) public inline fun StateContext.createChildContext( setup: (StateContext) -> Unit = {} ): StateContext { - val applied = this[ConfigurationPlugin] - ?.onConfigure(context = this) - ?: this + var applied = this + + applied = this[ConfigurationPlugin]?.onConfigure(applied) ?: applied + + // intentionally using this[LifecyclePlugin], not applied[LifecyclePlugin] + // in order to ignore lifecycle interceptors installed in onConfigure + applied = this[LifecyclePlugin]?.onChildCreate(applied) ?: applied applied.apply(setup) diff --git a/core/src/commonMain/kotlin/ksm/context/configuration/interceptor/ConfigurationInterceptor.kt b/core/src/commonMain/kotlin/ksm/context/configuration/interceptor/ConfigurationInterceptor.kt deleted file mode 100644 index 0c19ca2..0000000 --- a/core/src/commonMain/kotlin/ksm/context/configuration/interceptor/ConfigurationInterceptor.kt +++ /dev/null @@ -1,10 +0,0 @@ -package ksm.context.configuration.interceptor - -import ksm.annotation.MutateContext -import ksm.context.StateContext - -public fun interface ConfigurationInterceptor { - - @MutateContext - public fun onConfigure(context: StateContext): StateContext -} diff --git a/core/src/commonMain/kotlin/ksm/context/configuration/plugin/ConfigurationStateController.kt b/core/src/commonMain/kotlin/ksm/context/configuration/plugin/ConfigurationStateController.kt deleted file mode 100644 index 65ee286..0000000 --- a/core/src/commonMain/kotlin/ksm/context/configuration/plugin/ConfigurationStateController.kt +++ /dev/null @@ -1,22 +0,0 @@ -package ksm.context.configuration.plugin - -import ksm.annotation.MutateContext -import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor - -internal class ConfigurationStateController : StateContext.Element { - override val key = ConfigurationStateController - - private val interceptors = mutableListOf() - - fun addInterceptor(interceptor: ConfigurationInterceptor) { - interceptors += interceptor - } - - @MutateContext - fun onConfigure(context: StateContext): StateContext { - return interceptors.fold(context) { acc, interceptor -> interceptor.onConfigure(acc) } - } - - companion object : StateContext.Key -} diff --git a/core/src/commonMain/kotlin/ksm/finish/once/plugin/FinishOncePlugin.kt b/core/src/commonMain/kotlin/ksm/finish/once/plugin/FinishOncePlugin.kt index e78f9ec..02d5eac 100644 --- a/core/src/commonMain/kotlin/ksm/finish/once/plugin/FinishOncePlugin.kt +++ b/core/src/commonMain/kotlin/ksm/finish/once/plugin/FinishOncePlugin.kt @@ -2,8 +2,8 @@ package ksm.finish.once.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.plugin.Plugin public object FinishOncePlugin : Plugin.Singleton { diff --git a/core/src/commonMain/kotlin/ksm/lifecycle/LifecycleInterceptor.kt b/core/src/commonMain/kotlin/ksm/lifecycle/LifecycleInterceptor.kt deleted file mode 100644 index 0258caf..0000000 --- a/core/src/commonMain/kotlin/ksm/lifecycle/LifecycleInterceptor.kt +++ /dev/null @@ -1,10 +0,0 @@ -package ksm.lifecycle - -import ksm.context.StateContext - -public interface LifecycleInterceptor { - public fun onCreate(context: StateContext) {} - public fun onResume(context: StateContext) {} - public fun onPause(context: StateContext) {} - public fun onFinish(context: StateContext) {} -} diff --git a/core/src/commonMain/kotlin/ksm/lifecycle/StateContext.kt b/core/src/commonMain/kotlin/ksm/lifecycle/StateContext.kt index dff3a3c..c42ac4b 100644 --- a/core/src/commonMain/kotlin/ksm/lifecycle/StateContext.kt +++ b/core/src/commonMain/kotlin/ksm/lifecycle/StateContext.kt @@ -1,12 +1,13 @@ package ksm.lifecycle import ksm.context.StateContext +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.plugin.LifecyclePlugin import ksm.plugin.plugin public fun StateContext.addLifecycleInterceptor(interceptor: LifecycleInterceptor) { plugin(LifecyclePlugin).addLifecycleInterceptor( context = this, - observer = interceptor + interceptor = interceptor ) } diff --git a/core/src/commonMain/kotlin/ksm/lifecycle/interceptor/CombinedLifecycleInterceptor.kt b/core/src/commonMain/kotlin/ksm/lifecycle/interceptor/CombinedLifecycleInterceptor.kt new file mode 100644 index 0000000..42a1c97 --- /dev/null +++ b/core/src/commonMain/kotlin/ksm/lifecycle/interceptor/CombinedLifecycleInterceptor.kt @@ -0,0 +1,35 @@ +package ksm.lifecycle.interceptor + +import ksm.context.StateContext + +internal class CombinedLifecycleInterceptor( + private val first: LifecycleInterceptor?, + private val second: LifecycleInterceptor +) : LifecycleInterceptor { + override fun onCreate(context: StateContext) { + first?.onCreate(context) + second.onCreate(context) + } + + override fun onPause(context: StateContext) { + first?.onPause(context) + second.onPause(context) + } + + override fun onResume(context: StateContext) { + first?.onResume(context) + second.onResume(context) + } + + override fun onFinish(context: StateContext) { + first?.onFinish(context) + second.onResume(context) + } + + override fun onChildCreate(context: StateContext): StateContext { + var applied = context + applied = first?.onChildCreate(applied) ?: applied + applied = second.onChildCreate(applied) + return applied + } +} diff --git a/core/src/commonMain/kotlin/ksm/lifecycle/interceptor/LifecycleInterceptor.kt b/core/src/commonMain/kotlin/ksm/lifecycle/interceptor/LifecycleInterceptor.kt new file mode 100644 index 0000000..6afb5e2 --- /dev/null +++ b/core/src/commonMain/kotlin/ksm/lifecycle/interceptor/LifecycleInterceptor.kt @@ -0,0 +1,18 @@ +package ksm.lifecycle.interceptor + +import ksm.context.StateContext + +public interface LifecycleInterceptor { + public fun onCreate(context: StateContext) {} + public fun onResume(context: StateContext) {} + public fun onPause(context: StateContext) {} + public fun onFinish(context: StateContext) {} + public fun onChildCreate(context: StateContext): StateContext = context +} + +public operator fun LifecycleInterceptor?.plus(other: LifecycleInterceptor): LifecycleInterceptor { + return CombinedLifecycleInterceptor( + first = this, + second = other + ) +} diff --git a/core/src/commonMain/kotlin/ksm/lifecycle/plugin/LifecycleEntry.kt b/core/src/commonMain/kotlin/ksm/lifecycle/plugin/LifecycleEntry.kt index 72b65c0..3dc60c5 100644 --- a/core/src/commonMain/kotlin/ksm/lifecycle/plugin/LifecycleEntry.kt +++ b/core/src/commonMain/kotlin/ksm/lifecycle/plugin/LifecycleEntry.kt @@ -1,37 +1,13 @@ package ksm.lifecycle.plugin import ksm.context.StateContext -import ksm.lifecycle.LifecycleInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor +import ksm.lifecycle.interceptor.plus internal class LifecycleEntry : StateContext.Element { override val key = LifecycleEntry - private val observers = mutableListOf() - - fun addInterceptor(observer: LifecycleInterceptor) { - observers += observer - } - - fun onCreate(context: StateContext) { - for (observer in observers) { - observer.onCreate(context) - } - } - fun onResume(context: StateContext) { - for (observer in observers) { - observer.onResume(context) - } - } - fun onPause(context: StateContext) { - for (observer in observers) { - observer.onPause(context) - } - } - fun onFinish(context: StateContext) { - for (observer in observers) { - observer.onFinish(context) - } - } + var interceptor: LifecycleInterceptor? = null companion object : StateContext.Key } diff --git a/core/src/commonMain/kotlin/ksm/lifecycle/plugin/LifecyclePlugin.kt b/core/src/commonMain/kotlin/ksm/lifecycle/plugin/LifecyclePlugin.kt index a895b9b..7e8ab4a 100644 --- a/core/src/commonMain/kotlin/ksm/lifecycle/plugin/LifecyclePlugin.kt +++ b/core/src/commonMain/kotlin/ksm/lifecycle/plugin/LifecyclePlugin.kt @@ -2,9 +2,10 @@ package ksm.lifecycle.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor -import ksm.lifecycle.LifecycleInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor +import ksm.lifecycle.interceptor.plus import ksm.plugin.Plugin public object LifecyclePlugin : Plugin.Singleton { @@ -24,21 +25,24 @@ public object LifecyclePlugin : Plugin.Singleton { public fun addLifecycleInterceptor( context: StateContext, - observer: LifecycleInterceptor + interceptor: LifecycleInterceptor ) { - context.require(LifecycleEntry).addInterceptor(observer) + context.require(LifecycleEntry).interceptor += interceptor } public fun onCreate(context: StateContext) { - context.require(LifecycleEntry).onCreate(context) + context.require(LifecycleEntry).interceptor?.onCreate(context) } public fun onResume(context: StateContext) { - context.require(LifecycleEntry).onResume(context) + context.require(LifecycleEntry).interceptor?.onResume(context) } public fun onPause(context: StateContext) { - context.require(LifecycleEntry).onPause(context) + context.require(LifecycleEntry).interceptor?.onPause(context) } public fun onFinish(context: StateContext) { - context.require(LifecycleEntry).onFinish(context) + context.require(LifecycleEntry).interceptor?.onFinish(context) + } + public fun onChildCreate(context: StateContext): StateContext { + return context.require(LifecycleEntry).interceptor?.onChildCreate(context) ?: context } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3b27df2..29fdfb3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,9 +9,9 @@ compose-compiler = "1.5.11" androidx-navigation = "2.7.7" androidx-lifecycle = "2.7.0" ktgbotapi = "11.0.0" -mdi = "0.0.37" +mdi = "0.0.38" -ksm = "0.0.28" +ksm = "0.0.29" [libraries] diff --git a/kotlinx-coroutines/src/commonMain/kotlin/ksm/coroutines/plugin/AwaitPlugin.kt b/kotlinx-coroutines/src/commonMain/kotlin/ksm/coroutines/plugin/AwaitPlugin.kt index ebf7781..a1151ac 100644 --- a/kotlinx-coroutines/src/commonMain/kotlin/ksm/coroutines/plugin/AwaitPlugin.kt +++ b/kotlinx-coroutines/src/commonMain/kotlin/ksm/coroutines/plugin/AwaitPlugin.kt @@ -2,8 +2,8 @@ package ksm.coroutines.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.coroutines.interceptor.AwaitInterceptor import ksm.plugin.Plugin diff --git a/kotlinx-coroutines/src/commonMain/kotlin/ksm/coroutines/plugin/CoroutinesPlugin.kt b/kotlinx-coroutines/src/commonMain/kotlin/ksm/coroutines/plugin/CoroutinesPlugin.kt index 85d4da9..f46fec6 100644 --- a/kotlinx-coroutines/src/commonMain/kotlin/ksm/coroutines/plugin/CoroutinesPlugin.kt +++ b/kotlinx-coroutines/src/commonMain/kotlin/ksm/coroutines/plugin/CoroutinesPlugin.kt @@ -6,14 +6,12 @@ import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor import ksm.plugin.Plugin -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.context.finish -import ksm.lifecycle.LifecycleInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor -import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext public class CoroutinesPlugin( private val scope: CoroutineScope diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/RememberStateController.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/RememberStateController.kt index 72f3a9c..2450652 100644 --- a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/RememberStateController.kt +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/RememberStateController.kt @@ -8,12 +8,14 @@ import ksm.annotation.LibraryConstructor import ksm.builder.StateControllerBuilder import ksm.navigation.compose.plugin.ComposePlugin import ksm.navigation.compose.plugin.ComposeSerializationStore +import ksm.navigation.compose.wrapper.ComposeWrapper import ksm.navigation.navigationStateController import ksm.navigation.serialization.restore @OptIn(LibraryConstructor::class) @Composable public fun rememberStateController( + wrapper: ComposeWrapper? = null, builder: StateControllerBuilder.() -> Unit ): StateController { val store = rememberSaveable( @@ -23,7 +25,7 @@ public fun rememberStateController( ) return remember(store) { navigationStateController { - install(ComposePlugin(store)) + install(ComposePlugin(store, wrapper)) builder() }.apply { context.restore() diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/StateContext.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/StateContext.kt new file mode 100644 index 0000000..b3c964e --- /dev/null +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/StateContext.kt @@ -0,0 +1,13 @@ +package ksm.navigation.compose + +import ksm.context.StateContext +import ksm.navigation.compose.interceptor.ComposeInterceptor +import ksm.navigation.compose.plugin.ComposePlugin +import ksm.plugin.plugin + +public fun StateContext.addComposeInterceptor(interceptor: ComposeInterceptor) { + plugin(ComposePlugin).addComposeInterceptor( + context = this, + interceptor = interceptor + ) +} diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/host/NavigationStateHost.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/host/NavigationStateHost.kt index 27f06cd..8b114e2 100644 --- a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/host/NavigationStateHost.kt +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/host/NavigationStateHost.kt @@ -27,7 +27,7 @@ public fun NavigationStateHost( currentContext ?: return val childController = currentContext.asStateController() val content = currentContext.plugin(ComposePlugin).content(currentContext) - content?.invoke(childController) + content?.Content(childController) } } } diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/interceptor/CombinedComposeInterceptor.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/interceptor/CombinedComposeInterceptor.kt new file mode 100644 index 0000000..775ef36 --- /dev/null +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/interceptor/CombinedComposeInterceptor.kt @@ -0,0 +1,16 @@ +package ksm.navigation.compose.interceptor + +import ksm.context.StateContext +import ksm.navigation.compose.plugin.ComposeContent + +internal class CombinedComposeInterceptor( + private val first: ComposeInterceptor?, + private val second: ComposeInterceptor +) : ComposeInterceptor { + override fun intercept(context: StateContext, base: ComposeContent): ComposeContent { + var applied = base + applied = first?.intercept(context, applied) ?: applied + applied = second.intercept(context, applied) + return applied + } +} diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/interceptor/ComposeInterceptor.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/interceptor/ComposeInterceptor.kt new file mode 100644 index 0000000..e3f97f5 --- /dev/null +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/interceptor/ComposeInterceptor.kt @@ -0,0 +1,18 @@ +package ksm.navigation.compose.interceptor + +import ksm.context.StateContext +import ksm.navigation.compose.plugin.ComposeContent + +public fun interface ComposeInterceptor { + public fun intercept( + context: StateContext, + base: ComposeContent + ): ComposeContent +} + +public operator fun ComposeInterceptor?.plus(other: ComposeInterceptor): ComposeInterceptor { + return CombinedComposeInterceptor( + first = this, + second = other + ) +} diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposeContent.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposeContent.kt new file mode 100644 index 0000000..4183fcf --- /dev/null +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposeContent.kt @@ -0,0 +1,9 @@ +package ksm.navigation.compose.plugin + +import androidx.compose.runtime.Composable +import ksm.StateController + +public fun interface ComposeContent { + @Composable + public fun Content(controller: StateController) +} diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposeEntry.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposeEntry.kt index f8a10c6..9d273d3 100644 --- a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposeEntry.kt +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposeEntry.kt @@ -1,13 +1,13 @@ package ksm.navigation.compose.plugin -import androidx.compose.runtime.Composable -import ksm.StateController import ksm.context.StateContext +import ksm.navigation.compose.interceptor.ComposeInterceptor -internal class ComposeEntry : StateContext.Element { +internal class ComposeEntry(var interceptor: ComposeInterceptor?) : StateContext.Element { override val key = ComposeEntry - var content: (@Composable StateController.() -> Unit)? = null + + var content: ComposeContent? = null companion object : StateContext.Key } diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposePlugin.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposePlugin.kt index 8bce362..27bc9b9 100644 --- a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposePlugin.kt +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/plugin/ComposePlugin.kt @@ -5,18 +5,25 @@ import androidx.compose.runtime.mutableStateOf import ksm.StateController import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor -import ksm.lifecycle.LifecycleInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor +import ksm.navigation.compose.wrapper.ComposeWrapper +import ksm.navigation.compose.interceptor.ComposeInterceptor +import ksm.navigation.compose.interceptor.plus +import ksm.navigation.compose.wrapper.toInterceptor import ksm.navigation.serialization.BaseSerializationStore import ksm.plugin.Plugin public class ComposePlugin( - private val store: BaseSerializationStore.String + private val store: BaseSerializationStore.String, + wrapper: ComposeWrapper? = null ) : Plugin { override val key: Companion = ComposePlugin + private val interceptor = wrapper?.toInterceptor() + internal val currentContext = mutableStateOf(value = null) @MutateContext @@ -30,7 +37,7 @@ public class ComposePlugin( @MutateContext override fun onConfigure(context: StateContext): StateContext { context.addLifecycleInterceptor(Lifecycle()) - return context + ComposeEntry() + return context + ComposeEntry(interceptor) } } @@ -40,14 +47,24 @@ public class ComposePlugin( } } - internal fun setContent( + public fun addComposeInterceptor( + context: StateContext, + interceptor: ComposeInterceptor + ) { + context.require(ComposeEntry).interceptor += interceptor + } + + public fun setContent( context: StateContext, content: @Composable StateController.() -> Unit ) { - context.require(ComposeEntry).content = content + val entry = context.require(ComposeEntry) + val interceptor = entry.interceptor + val base = ComposeContent(content) + entry.content = interceptor?.intercept(context, base) ?: base } - internal fun content(context: StateContext): (@Composable StateController.() -> Unit)? { + public fun content(context: StateContext): ComposeContent? { return context.require(ComposeEntry).content } diff --git a/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/wrapper/ComposeWrapper.kt b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/wrapper/ComposeWrapper.kt new file mode 100644 index 0000000..176b3bb --- /dev/null +++ b/navigation/navigation-compose/src/main/kotlin/ksm/navigation/compose/wrapper/ComposeWrapper.kt @@ -0,0 +1,17 @@ +package ksm.navigation.compose.wrapper + +import ksm.StateController +import ksm.asStateController +import ksm.navigation.compose.interceptor.ComposeInterceptor +import ksm.navigation.compose.plugin.ComposeContent + +public fun interface ComposeWrapper { + public fun StateController.wrap(content: ComposeContent): ComposeContent +} + +public fun ComposeWrapper.toInterceptor(): ComposeInterceptor { + return ComposeInterceptor { context, base -> + val controller = context.asStateController() + controller.wrap(base) + } +} diff --git a/navigation/navigation-ktgbotapi/src/commonMain/kotlin/ksm/navigation/ktgbotapi/plugin/TelegramBotApiPlugin.kt b/navigation/navigation-ktgbotapi/src/commonMain/kotlin/ksm/navigation/ktgbotapi/plugin/TelegramBotApiPlugin.kt index d596870..79ed283 100644 --- a/navigation/navigation-ktgbotapi/src/commonMain/kotlin/ksm/navigation/ktgbotapi/plugin/TelegramBotApiPlugin.kt +++ b/navigation/navigation-ktgbotapi/src/commonMain/kotlin/ksm/navigation/ktgbotapi/plugin/TelegramBotApiPlugin.kt @@ -5,8 +5,8 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update import ksm.StateController import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.navigation.ktgbotapi.TelegramPeerKey import ksm.plugin.Plugin diff --git a/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/StateContext.kt b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/StateContext.kt index ba97e17..2c7af4a 100644 --- a/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/StateContext.kt +++ b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/StateContext.kt @@ -3,8 +3,18 @@ package ksm.navigation.mdi import app.meetacy.di.DI import ksm.navigation.mdi.plugin.DIPlugin import ksm.context.StateContext +import ksm.lifecycle.addLifecycleInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor +import ksm.navigation.mdi.interceptor.DIInterceptor import ksm.plugin.plugin public var StateContext.di: DI get() = plugin(DIPlugin).di(context = this) set(value) = plugin(DIPlugin).setDI(context = this, di = value) + +public fun StateContext.addDIInterceptor(interceptor: DIInterceptor) { + plugin(DIPlugin).addDIInterceptor( + context = this, + interceptor = interceptor + ) +} diff --git a/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/interceptor/CombinedDIInterceptor.kt b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/interceptor/CombinedDIInterceptor.kt new file mode 100644 index 0000000..919c42b --- /dev/null +++ b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/interceptor/CombinedDIInterceptor.kt @@ -0,0 +1,16 @@ +package ksm.navigation.mdi.interceptor + +import app.meetacy.di.DI +import ksm.context.StateContext + +internal class CombinedDIInterceptor( + private val first: DIInterceptor?, + private val second: DIInterceptor +) : DIInterceptor { + override fun intercept(context: StateContext, base: DI): DI { + var applied = base + applied = first?.intercept(context, applied) ?: applied + applied = second.intercept(context, applied) + return applied + } +} diff --git a/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/interceptor/DIInterceptor.kt b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/interceptor/DIInterceptor.kt new file mode 100644 index 0000000..68cfad3 --- /dev/null +++ b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/interceptor/DIInterceptor.kt @@ -0,0 +1,18 @@ +package ksm.navigation.mdi.interceptor + +import app.meetacy.di.DI +import ksm.context.StateContext + +public fun interface DIInterceptor { + public fun intercept( + context: StateContext, + base: DI + ): DI +} + +public operator fun DIInterceptor?.plus(other: DIInterceptor): DIInterceptor { + return CombinedDIInterceptor( + first = this, + second = other + ) +} diff --git a/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/plugin/DIEntry.kt b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/plugin/DIEntry.kt index ef1739f..65f756e 100644 --- a/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/plugin/DIEntry.kt +++ b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/plugin/DIEntry.kt @@ -2,11 +2,13 @@ package ksm.navigation.mdi.plugin import app.meetacy.di.DI import ksm.context.StateContext +import ksm.navigation.mdi.interceptor.DIInterceptor -internal class DIEntry(base: DI? = null) : StateContext.Element { +internal class DIEntry : StateContext.Element { override val key = DIEntry - var di: DI? = base + var interceptor: DIInterceptor? = null + var di: DI? = null companion object : StateContext.Key } diff --git a/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/plugin/DIPlugin.kt b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/plugin/DIPlugin.kt index 4d8b3d0..3200ecc 100644 --- a/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/plugin/DIPlugin.kt +++ b/navigation/navigation-mdi/src/commonMain/kotlin/ksm/navigation/mdi/plugin/DIPlugin.kt @@ -6,11 +6,14 @@ import app.meetacy.di.builder.di import ksm.annotation.MutateContext import ksm.asStateController import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor import ksm.plugin.Plugin -import ksm.context.configuration.interceptor.addConfigurationInterceptor -import ksm.lifecycle.LifecycleInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor +import ksm.navigation.mdi.addDIInterceptor +import ksm.navigation.mdi.interceptor.DIInterceptor +import ksm.navigation.mdi.interceptor.plus public class DIPlugin( private val root: DI = di { }, @@ -22,35 +25,41 @@ public class DIPlugin( @MutateContext override fun install(context: StateContext): StateContext { context.addConfigurationInterceptor(Configuration()) - return context + DIEntry(root) + val entry = DIEntry() + entry.di = root + return context + entry } private inner class Configuration : ConfigurationInterceptor { @MutateContext override fun onConfigure(context: StateContext): StateContext { - context.addLifecycleInterceptor(Lifecycle()) - return context + DIEntry() + val applied = context + DIEntry() + applied.addDIInterceptor(DefaultInterceptor()) + return applied } } - private inner class Lifecycle : LifecycleInterceptor { - override fun onCreate(context: StateContext) { - val entry = context.require(DIEntry) - var di = di(root, checkDependencies, perStateDI) + di { - val stateController by constant(context.asStateController()) - } - val entryDI = entry.di - if (entryDI != null) di += entryDI - entry.di = di + private inner class DefaultInterceptor : DIInterceptor { + override fun intercept(context: StateContext, base: DI): DI { + var applied = base + applied += di(root, checkDependencies, perStateDI) + applied += di { val stateController by constant(context.asStateController()) } + return applied } } + public fun addDIInterceptor(context: StateContext, interceptor: DIInterceptor) { + context.require(DIEntry).interceptor += interceptor + } + public fun di(context: StateContext): DI { return context.require(DIEntry).di ?: error("DI is not initialized") } public fun setDI(context: StateContext, di: DI) { - context.require(DIEntry).di = di + val entry = context.require(DIEntry) + val interceptor = entry.interceptor + entry.di = interceptor?.intercept(context, di) ?: di } public companion object : StateContext.Key diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/result/plugin/NavigationResultPlugin.kt b/navigation/src/commonMain/kotlin/ksm/navigation/result/plugin/NavigationResultPlugin.kt index f8d7ae5..80eeea4 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/result/plugin/NavigationResultPlugin.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/result/plugin/NavigationResultPlugin.kt @@ -2,10 +2,10 @@ package ksm.navigation.result.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.context.finish -import ksm.lifecycle.LifecycleInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor import ksm.navigation.state.navigate import ksm.navigation.state.parameters.receiveParameter diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/serialization/plugin/BaseSerializationPlugin.kt b/navigation/src/commonMain/kotlin/ksm/navigation/serialization/plugin/BaseSerializationPlugin.kt index 1d94db6..cc497b6 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/serialization/plugin/BaseSerializationPlugin.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/serialization/plugin/BaseSerializationPlugin.kt @@ -2,9 +2,9 @@ package ksm.navigation.serialization.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor -import ksm.lifecycle.LifecycleInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor import ksm.navigation.state.parameters.interceptor.addParametersInterceptor import ksm.plugin.Plugin diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/stack/lifecycle/plugin/FirstStackLifecyclePlugin.kt b/navigation/src/commonMain/kotlin/ksm/navigation/stack/lifecycle/plugin/FirstStackLifecyclePlugin.kt index 0a9c3aa..2e69199 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/stack/lifecycle/plugin/FirstStackLifecyclePlugin.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/stack/lifecycle/plugin/FirstStackLifecyclePlugin.kt @@ -2,8 +2,8 @@ package ksm.navigation.stack.lifecycle.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.lifecycle.plugin.LifecyclePlugin import ksm.plugin.Plugin diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/stack/lifecycle/plugin/LastStackLifecyclePlugin.kt b/navigation/src/commonMain/kotlin/ksm/navigation/stack/lifecycle/plugin/LastStackLifecyclePlugin.kt index 779ace5..b75d6ab 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/stack/lifecycle/plugin/LastStackLifecyclePlugin.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/stack/lifecycle/plugin/LastStackLifecyclePlugin.kt @@ -2,9 +2,9 @@ package ksm.navigation.stack.lifecycle.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor -import ksm.lifecycle.LifecycleInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor import ksm.lifecycle.plugin.LifecyclePlugin import ksm.navigation.stack.previousContextOrNull diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/stack/plugin/StackPlugin.kt b/navigation/src/commonMain/kotlin/ksm/navigation/stack/plugin/StackPlugin.kt index d48e60a..e2ffe28 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/stack/plugin/StackPlugin.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/stack/plugin/StackPlugin.kt @@ -2,10 +2,10 @@ package ksm.navigation.stack.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor import ksm.plugin.Plugin -import ksm.context.configuration.interceptor.addConfigurationInterceptor -import ksm.lifecycle.LifecycleInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor import ksm.lifecycle.plugin.LifecyclePlugin import ksm.navigation.annotation.InstallStackPlugin diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/state/name/plugin/StateNamePlugin.kt b/navigation/src/commonMain/kotlin/ksm/navigation/state/name/plugin/StateNamePlugin.kt index 455ae3c..a4e228d 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/state/name/plugin/StateNamePlugin.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/state/name/plugin/StateNamePlugin.kt @@ -2,8 +2,8 @@ package ksm.navigation.state.name.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.plugin.Plugin public object StateNamePlugin : Plugin.Singleton { diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/state/parameters/plugin/StateParametersPlugin.kt b/navigation/src/commonMain/kotlin/ksm/navigation/state/parameters/plugin/StateParametersPlugin.kt index 86a50c0..46a9218 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/state/parameters/plugin/StateParametersPlugin.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/state/parameters/plugin/StateParametersPlugin.kt @@ -2,8 +2,8 @@ package ksm.navigation.state.parameters.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.navigation.state.parameters.interceptor.ParametersInterceptor import ksm.navigation.state.parameters.interceptor.memory.MemoryParametersInterceptor import ksm.plugin.Plugin diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateControllerBuilder.kt b/navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateControllerBuilder.kt index e4a4f34..e495194 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateControllerBuilder.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateControllerBuilder.kt @@ -1,10 +1,6 @@ package ksm.navigation.state.route import ksm.builder.StateControllerBuilder -import ksm.context.StateContext -import ksm.lifecycle.LifecycleInterceptor -import ksm.lifecycle.addLifecycleInterceptor -import ksm.navigation.state.route.StateRouteScope public fun StateControllerBuilder.states(block: StateRouteScope.() -> Unit) { install(StateRoutePlugin(block)) diff --git a/navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateRoutePlugin.kt b/navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateRoutePlugin.kt index 2d36adf..e6ec3f1 100644 --- a/navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateRoutePlugin.kt +++ b/navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateRoutePlugin.kt @@ -2,9 +2,9 @@ package ksm.navigation.state.route import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor -import ksm.lifecycle.LifecycleInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor import ksm.plugin.Plugin diff --git a/navigation/src/commonTest/kotlin/Test.kt b/navigation/src/commonTest/kotlin/Test.kt index 33e629e..7f666cc 100644 --- a/navigation/src/commonTest/kotlin/Test.kt +++ b/navigation/src/commonTest/kotlin/Test.kt @@ -1,9 +1,9 @@ import ksm.annotation.LibraryConstructor import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor -import ksm.lifecycle.LifecycleInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor +import ksm.lifecycle.interceptor.LifecycleInterceptor import ksm.lifecycle.addLifecycleInterceptor import ksm.navigation.state.name.name import ksm.navigation.state.navigate diff --git a/viewmodel/src/commonMain/kotlin/ksm/viewmodel/exceptions/plugin/ExceptionHandlerPlugin.kt b/viewmodel/src/commonMain/kotlin/ksm/viewmodel/exceptions/plugin/ExceptionHandlerPlugin.kt index 276089c..eab27d6 100644 --- a/viewmodel/src/commonMain/kotlin/ksm/viewmodel/exceptions/plugin/ExceptionHandlerPlugin.kt +++ b/viewmodel/src/commonMain/kotlin/ksm/viewmodel/exceptions/plugin/ExceptionHandlerPlugin.kt @@ -2,8 +2,8 @@ package ksm.viewmodel.exceptions.plugin import ksm.annotation.MutateContext import ksm.context.StateContext -import ksm.context.configuration.interceptor.ConfigurationInterceptor -import ksm.context.configuration.interceptor.addConfigurationInterceptor +import ksm.configuration.interceptor.ConfigurationInterceptor +import ksm.configuration.interceptor.addConfigurationInterceptor import ksm.viewmodel.exceptions.ExceptionHandler import ksm.plugin.Plugin