Repository: InsertKoinIO/koin
File: projects/compose/koin-compose/src/commonMain/kotlin/org/koin/compose/KoinApplication.kt (Kotlin)

Code before:
import org.koin.core.annotation.KoinInternalApi
import org.koin.core.logger.Level
import org.koin.core.scope.Scope
import org.koin.dsl.KoinAppDeclaration
import org.koin.dsl.KoinConfiguration
import org.koin.dsl.koinApplication
import org.koin.mp.KoinPlatform
import org.koin.mp.KoinPlatformTools


/**
 * Internal API - Deprecated
 * Current Koin Scope, as default with Default Koin context root scope
 *
 * @see LocalKoinScopeContext
 */
//For Compat with 4.1.0
@Deprecated("LocalKoinScope has been replaced with LocalKoinScopeContext, using ComposeContextWrapper.getValue() to retrieve the value" , level = DeprecationLevel.ERROR ,replaceWith = ReplaceWith("LocalKoinScopeContext"))
val LocalKoinScope: ProvidableCompositionLocal<Scope> = error(" should not be used in favor LocalKoinScope")

/**
 * Deprecated - Internal API
 * Current Koin Application context, as default with Default Koin context
 */
//For Compat with 4.1.0
@Deprecated("LocalKoinApplication is deprecated and" , level = DeprecationLevel.ERROR ,replaceWith = ReplaceWith("getKoin()"))
val LocalKoinApplication :  ProvidableCompositionLocal<Koin> = error(" should not be used in favor getKoin()")

/**
 * Internal API
 * Current Koin Scope, as default with Default Koin context root scope
 *
 * @see ComposeContextWrapper
 */
//TODO later make it internal
@KoinInternalApi
val LocalKoinScopeContext: ProvidableCompositionLocal<ComposeContextWrapper<Scope>> = compositionLocalOf { ComposeContextWrapper(getDefaultRootScope()) { getDefaultRootScope() } }

/**
 * Internal API
 * Current Koin Application context, as default with Default Koin context
 *
 * @see ComposeContextWrapper
 */
@KoinInternalApi
internal val LocalKoinApplicationContext: ProvidableCompositionLocal<ComposeContextWrapper<Koin>> = compositionLocalOf { ComposeContextWrapper(getDefaultKoinContext()) { getDefaultKoinContext() } }

private fun getDefaultKoinContext() = KoinPlatform.getKoin()

@OptIn(KoinInternalApi::class)
private fun getDefaultRootScope() = KoinPlatform.getKoin().scopeRegistry.rootScope

Review comment (suggestion):
The deprecation message is incomplete, ending with 'and'. It should provide a complete explanation, such as 'LocalKoinApplication is deprecated. Use getKoin() to access the Koin instance directly.'
```suggestion
@Deprecated("LocalKoinApplication is deprecated. Use getKoin() to access the Koin instance directly.", level = DeprecationLevel.ERROR, replaceWith = ReplaceWith("getKoin()"))
```

Code after:
import org.koin.core.annotation.KoinInternalApi
import org.koin.core.logger.Level
import org.koin.core.scope.Scope
import org.koin.dsl.KoinAppDeclaration
import org.koin.dsl.KoinConfiguration
import org.koin.dsl.koinApplication
import org.koin.mp.KoinPlatform
import org.koin.mp.KoinPlatformTools


/**
 * Internal API - Deprecated
 * Current Koin Scope, as default with Default Koin context root scope
 *
 * @see LocalKoinScopeContext
 */
//For Compat with 4.1.0
@Deprecated("LocalKoinScope has been replaced with LocalKoinScopeContext, using ComposeContextWrapper.getValue() to retrieve the value" , level = DeprecationLevel.ERROR ,replaceWith = ReplaceWith("LocalKoinScopeContext"))
val LocalKoinScope: ProvidableCompositionLocal<Scope> = error(" should not be used in favor of LocalKoinScopeContext")

/**
 * Deprecated - Internal API
 * Current Koin Application context, as default with Default Koin context
 */
//For Compat with 4.1.0
@Deprecated("LocalKoinApplication is deprecated. Use getKoin() to access the Koin instance directly.", level = DeprecationLevel.ERROR, replaceWith = ReplaceWith("getKoin()"))
val LocalKoinApplication :  ProvidableCompositionLocal<Koin> = error(" should not be used in favor of getKoin()")

/**
 * Internal API
 * Current Koin Scope, as default with Default Koin context root scope
 *
 * @see ComposeContextWrapper
 */
//TODO later make it internal
@KoinInternalApi
val LocalKoinScopeContext: ProvidableCompositionLocal<ComposeContextWrapper<Scope>> = compositionLocalOf { ComposeContextWrapper(getDefaultRootScope()) { getDefaultRootScope() } }

/**
 * Internal API
 * Current Koin Application context, as default with Default Koin context
 *
 * @see ComposeContextWrapper
 */
@KoinInternalApi
internal val LocalKoinApplicationContext: ProvidableCompositionLocal<ComposeContextWrapper<Koin>> = compositionLocalOf { ComposeContextWrapper(getDefaultKoinContext()) { getDefaultKoinContext() } }

private fun getDefaultKoinContext() = KoinPlatform.getKoin()

@OptIn(KoinInternalApi::class)
private fun getDefaultRootScope() = KoinPlatform.getKoin().scopeRegistry.rootScope