From 4f7fc120612d3049bf698b689b6f7cf956b3aa1a Mon Sep 17 00:00:00 2001 From: Arnaud Giuliani Date: Wed, 15 May 2024 18:14:53 +0200 Subject: [PATCH] use Koin KMP tool for Class name --- .../commonMain/kotlin/org/koin/compose/ViewModelInternals.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/compose/koin-compose-viewmodel/src/commonMain/kotlin/org/koin/compose/ViewModelInternals.kt b/projects/compose/koin-compose-viewmodel/src/commonMain/kotlin/org/koin/compose/ViewModelInternals.kt index 611ef9a4f..43b5fb186 100644 --- a/projects/compose/koin-compose-viewmodel/src/commonMain/kotlin/org/koin/compose/ViewModelInternals.kt +++ b/projects/compose/koin-compose-viewmodel/src/commonMain/kotlin/org/koin/compose/ViewModelInternals.kt @@ -28,6 +28,7 @@ import org.koin.core.parameter.ParametersDefinition import org.koin.core.parameter.ParametersHolder import org.koin.core.qualifier.Qualifier import org.koin.core.scope.Scope +import org.koin.mp.KoinPlatformTools import kotlin.reflect.KClass @KoinInternalApi @@ -42,7 +43,7 @@ fun resolveViewModel( ): T { val factory = KoinViewModelFactory(vmClass, scope, qualifier, parameters) val provider = ViewModelProvider.create(viewModelStore, factory, extras) - val vmKey = getViewModelKey(qualifier, key, vmClass.qualifiedName) + val vmKey = getViewModelKey(qualifier, key, KoinPlatformTools.getClassName(vmClass)) return when { vmKey != null -> provider[vmKey, vmClass] else -> provider[vmClass]