Skip to content

Commit

Permalink
Resolved issues #2031 and #2024 by integrating the benasher44/uuid li…
Browse files Browse the repository at this point in the history
…brary to generate UUIDs for WebAssembly targets.
  • Loading branch information
kdroidFilter committed Nov 4, 2024
1 parent 4c56aa0 commit f69de5a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 1 deletion.
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

0 comments on commit f69de5a

Please sign in to comment.