From 4cba2bf083ebec6e2f297ea0cffe473fd5119285 Mon Sep 17 00:00:00 2001 From: theophiluskibet Date: Fri, 27 Sep 2024 09:24:30 +0300 Subject: [PATCH] fix warning shown when KOIN_USE_COMPOSE_VIEWMODEL arg is used --- .../kotlin/org/koin/compiler/BuilderProcessor.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/BuilderProcessor.kt b/projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/BuilderProcessor.kt index 95c2223..11c0eb9 100644 --- a/projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/BuilderProcessor.kt +++ b/projects/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/BuilderProcessor.kt @@ -82,13 +82,16 @@ class BuilderProcessor( //TODO Use Koin 4.0 ViewModel DSL @Deprecated("use isKoinComposeViewModelActive") private fun isComposeViewModelActive(): Boolean { - logger.warn("[Deprecated] 'USE_COMPOSE_VIEWMODEL' arg is deprecated. Please use 'KOIN_USE_COMPOSE_VIEWMODEL'") - return options.getOrDefault(USE_COMPOSE_VIEWMODEL.name, "false") == true.toString() + val option = options.getOrDefault(USE_COMPOSE_VIEWMODEL.name, "false") == true.toString() + if (option) logger.warn("[Deprecated] 'USE_COMPOSE_VIEWMODEL' arg is deprecated. Please use 'KOIN_USE_COMPOSE_VIEWMODEL'") + return option } private fun isKoinComposeViewModelActive(): Boolean { - logger.warn("Activate Compose ViewModel for @KoinViewModel generation") - return options.getOrDefault(KOIN_USE_COMPOSE_VIEWMODEL.name, "false") == true.toString() + val option = + options.getOrDefault(KOIN_USE_COMPOSE_VIEWMODEL.name, "false") == true.toString() + if (option) logger.warn("Activate Compose ViewModel for @KoinViewModel generation") + return option } //TODO turn KOIN_DEFAULT_MODULE to false by default - Next Major version (breaking)