Skip to content

Commit

Permalink
Merge branch 'main' into 4.0.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/setup/koin.md
  • Loading branch information
arnaudgiuliani committed Nov 15, 2024
2 parents 87da9be + fa85a19 commit 3442d11
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 38 deletions.
3 changes: 3 additions & 0 deletions docs/quickstart/cmp.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ fun App() {
modules(appModule)
}
)
{
// Compose content
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ The `modules()` function in `startKoin` load the given list of modules

## Koin module: classic or constructor DSL?

Here is the Koin moduel declaration for our app:
Here is the Koin module declaration for our app:

```kotlin
val appModule = module {
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/koin-core/context-isolation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The `MyIsolatedKoinContext` class is holding our Koin instance here:
// Get a Context for your Koin instance
object MyIsolatedKoinContext {

val koinApp = koinApplication {
private val koinApp = koinApplication {
// declare used modules
modules(coffeeAppModule)
}
Expand All @@ -40,7 +40,7 @@ object MyIsolatedKoinContext {
Let's use `MyIsolatedKoinContext` to define our `IsolatedKoinComponent` class, a KoinComponent that will use our isolated context:

```kotlin
abstract class IsolatedKoinComponent : KoinComponent {
internal interface IsolatedKoinComponent : KoinComponent {

// Override default Koin instance
override fun getKoin(): Koin = MyIsolatedKoinContext.koin
Expand All @@ -50,7 +50,7 @@ abstract class IsolatedKoinComponent : KoinComponent {
Everything is ready, just use `IsolatedKoinComponent` to retrieve instances from isolated context:

```kotlin
class MyKoinComponent : IsolatedKoinComponent(){
class MyKoinComponent : IsolatedKoinComponent {
// inject & get will target MyKoinContext
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/koin-core/dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Koin DSL
---

Thanks to the power of Kotlin language, Koin provides a DSL to help your describe your app instead of annotate it or generate code for it. With its Kotlin DSL, Koin offers a smart functional API to achieve to prepare your dependency injection.
Thanks to the power of Kotlin language, Koin provides a DSL to help you describe your app instead of annotate it or generate code for it. With its Kotlin DSL, Koin offers a smart functional API to achieve to prepare your dependency injection.

## Application & Module DSL

Expand Down
54 changes: 27 additions & 27 deletions docs/setup/koin.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ You can find all Koin packages on [maven central](https://search.maven.org/searc

Here are the currently available versions:

| Project | Version |
|-----------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| koin-bom | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-bom)](https://mvnrepository.com/artifact/io.insert-koin/koin-bom) |
| koin-core | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-core)](https://mvnrepository.com/artifact/io.insert-koin/koin-core) |
| koin-core-viewmodel | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-core-viewmodel)](https://mvnrepository.com/artifact/io.insert-koin/koin-core-viewmodel) |
| koin-core-viewmodel-navigation | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-core-viewmodel-navigation)](https://mvnrepository.com/artifact/io.insert-koin/koin-core-viewmodel-navigation) |
| koin-core-coroutines | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-core-coroutines)](https://mvnrepository.com/artifact/io.insert-koin/koin-core-coroutines) |
| koin-test | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-test)](https://mvnrepository.com/artifact/io.insert-koin/koin-test) |
| koin-test-junit4 | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-test-junit4)](https://mvnrepository.com/artifact/io.insert-koin/koin-test-junit4) |
| koin-test-junit5 | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-test-junit5)](https://mvnrepository.com/artifact/io.insert-koin/koin-test-junit5) |
| koin-android | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-android)](https://mvnrepository.com/artifact/io.insert-koin/koin-android) |
| koin-android-test | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-android-test)](https://mvnrepository.com/artifact/io.insert-koin/koin-android-test) |
| koin-android-compat | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-android-compat)](https://mvnrepository.com/artifact/io.insert-koin/koin-android-compat) |
| koin-androidx-navigation | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-navigation)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-navigation) |
| koin-androidx-workmanager | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-workmanager)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-workmanager) |
| koin-androidx-startup | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-startup)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-startup) |
| koin-compose | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-compose)](https://mvnrepository.com/artifact/io.insert-koin/koin-compose) |
| koin-compose-viewmodel | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-compose-viewmodel)](https://mvnrepository.com/artifact/io.insert-koin/koin-compose-viewmodel) |
| koin-compose-viewmodel-navigation | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-compose-viewmodel-navigation)](https://mvnrepository.com/artifact/io.insert-koin/koin-compose-viewmodel-navigation) |
| koin-androidx-compose | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-compose)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-compose) |
| koin-androidx-compose-navigation | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-compose-navigation)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-compose-navigation) |
| koin-ktor | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-ktor)](https://mvnrepository.com/artifact/io.insert-koin/koin-ktor) |
| koin-logger-slf4j | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-logger-slf4j)](https://mvnrepository.com/artifact/io.insert-koin/koin-logger-slf4j) |
| Project | Version |
|----------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| koin-bom | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-bom)](https://mvnrepository.com/artifact/io.insert-koin/koin-bom) |
| koin-core | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-core)](https://mvnrepository.com/artifact/io.insert-koin/koin-core) |
| koin-core-viewmodel | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-core-viewmodel)](https://mvnrepository.com/artifact/io.insert-koin/koin-core-viewmodel) |
| koin-core-viewmodel-navigation | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-core-viewmodel-navigation)](https://mvnrepository.com/artifact/io.insert-koin/koin-core-viewmodel-navigation) |
| koin-core-coroutines | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-core-coroutines)](https://mvnrepository.com/artifact/io.insert-koin/koin-core-coroutines) |
| koin-test | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-test)](https://mvnrepository.com/artifact/io.insert-koin/koin-test) |
| koin-test-junit4 | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-test-junit4)](https://mvnrepository.com/artifact/io.insert-koin/koin-test-junit4) |
| koin-test-junit5 | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-test-junit5)](https://mvnrepository.com/artifact/io.insert-koin/koin-test-junit5) |
| koin-android | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-android)](https://mvnrepository.com/artifact/io.insert-koin/koin-android) |
| koin-android-test | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-android-test)](https://mvnrepository.com/artifact/io.insert-koin/koin-android-test) |
| koin-android-compat | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-android-compat)](https://mvnrepository.com/artifact/io.insert-koin/koin-android-compat) |
| koin-androidx-navigation | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-navigation)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-navigation) |
| koin-androidx-workmanager | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-workmanager)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-workmanager) |
| koin-androidx-startup | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-startup)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-startup) |
| koin-compose | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-compose)](https://mvnrepository.com/artifact/io.insert-koin/koin-compose) |
| koin-compose-viewmodel | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-compose-viewmodel)](https://mvnrepository.com/artifact/io.insert-koin/koin-compose-viewmodel) |
| koin-compose-viewmodel-navigation| [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-compose-viewmodel-navigation)](https://mvnrepository.com/artifact/io.insert-koin/koin-compose-viewmodel-navigation) |
| koin-androidx-compose | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-compose)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-compose) |
| koin-androidx-compose-navigation | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-androidx-compose-navigation)](https://mvnrepository.com/artifact/io.insert-koin/koin-androidx-compose-navigation) |
| koin-ktor | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-ktor)](https://mvnrepository.com/artifact/io.insert-koin/koin-ktor) |
| koin-logger-slf4j | [![Maven Central](https://img.shields.io/maven-central/v/io.insert-koin/koin-logger-slf4j)](https://mvnrepository.com/artifact/io.insert-koin/koin-logger-slf4j) |

## Gradle Setup

Expand Down Expand Up @@ -113,7 +113,7 @@ You are now ready to start Koin in your `Application` class:
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()

startKoin {
modules(appModule)
}
Expand Down Expand Up @@ -211,15 +211,15 @@ The Koin Bill of Materials (BOM) lets you manage all of your Koin library versio
dependencies {
// Declare koin-bom version
implementation platform("io.insert-koin:koin-bom:$koin_bom")
// Declare the koin dependencies that you need
implementation("io.insert-koin:koin-android")
implementation("io.insert-koin:koin-core-coroutines")
implementation("io.insert-koin:koin-androidx-workmanager")
// If you need specify some version it's just point to desired version
implementation("io.insert-koin:koin-androidx-navigation:1.2.3-alpha03")
// Works with test libraries too!
testImplementation("io.insert-koin:koin-test-junit4")
testImplementation("io.insert-koin:koin-android-test")
Expand Down
3 changes: 3 additions & 0 deletions projects/core/koin-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ kotlin {
implementation(libs.kotlin.test)
implementation(libs.test.coroutines)
}
wasmJsMain.dependencies {
implementation(libs.uuid)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ expect object KoinPlatformTools {

fun KoinPlatformTools.getKClassDefaultName(kClass: KClass<*>) : String = "KClass@${kClass.hashCode()}"
@OptIn(ExperimentalUuidApi::class)
fun KoinPlatformTools.generateId() : String = Uuid.random().toString()
expect fun KoinPlatformTools.generateId() : String

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.koin.mp

import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

@OptIn(ExperimentalUuidApi::class)
actual fun KoinPlatformTools.generateId(): String = Uuid.random().toString()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.koin.mp

import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

@OptIn(ExperimentalUuidApi::class)
actual fun KoinPlatformTools.generateId(): String = Uuid.random().toString()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.koin.mp

import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

@OptIn(ExperimentalUuidApi::class)
actual fun KoinPlatformTools.generateId(): String = Uuid.random().toString()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.koin.mp

import com.benasher44.uuid.uuid4

actual fun KoinPlatformTools.generateId(): String = uuid4().toString()
2 changes: 2 additions & 0 deletions projects/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mockk = "1.13.2"
# Ktor
ktor = "2.3.12"
slf4j = "2.0.13"
uuidVersion = "0.8.4"

[libraries]
# Core
Expand Down Expand Up @@ -79,6 +80,7 @@ jb-bundle = { module = "org.jetbrains.androidx.core:core-bundle", version.ref =
jb-savedstate = { module = "org.jetbrains.androidx.savedstate:savedstate", version.ref = "jbSavedState" }
jb-composeNavigation = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "composeNavigation" }
jb-navigation = { module = "org.jetbrains.androidx.navigation:navigation-common", version.ref = "composeNavigation" }
uuid = { module = "com.benasher44:uuid", version.ref = "uuidVersion" }

[plugins]
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
Expand Down
2 changes: 1 addition & 1 deletion projects/gradle/publish-android.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ configure<PublishingExtension> {
}
scm {
url.set("https://github.com/InsertKoinIO/koin")
connection.set("https://github.com/InsertKoinIO/koin.git")
connection.set("scm:git:https://github.com/InsertKoinIO/koin.git")
}
developers {
developer {
Expand Down
2 changes: 1 addition & 1 deletion projects/gradle/publish-java.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ configure<PublishingExtension> {
}
scm {
url.set("https://github.com/InsertKoinIO/koin")
connection.set("https://github.com/InsertKoinIO/koin.git")
connection.set("scm:git:https://github.com/InsertKoinIO/koin.git")
}
developers {
developer {
Expand Down
2 changes: 1 addition & 1 deletion projects/gradle/publish-pom.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ configure<PublishingExtension> {
}
scm {
url.set("https://github.com/InsertKoinIO/koin")
connection.set("https://github.com/InsertKoinIO/koin.git")
connection.set("scm:git:https://github.com/InsertKoinIO/koin.git")
}
developers {
developer {
Expand Down
2 changes: 1 addition & 1 deletion projects/gradle/publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ configure<PublishingExtension> {
}
scm {
url.set("https://github.com/InsertKoinIO/koin")
connection.set("https://github.com/InsertKoinIO/koin.git")
connection.set("scm:git:https://github.com/InsertKoinIO/koin.git")
}
developers {
developer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class SLF4JLogger(level: Level = Level.INFO) : Logger(level) {
Level.DEBUG -> logger.debug(msg)
Level.INFO -> logger.info(msg)
Level.ERROR -> logger.error(msg)
Level.WARNING -> logger.warn(msg)
else -> logger.error(msg)
}
}
}
}

0 comments on commit 3442d11

Please sign in to comment.