From 6a4b904b9a8a375710975d87aaa3d4de525e051c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 5 Nov 2019 12:14:36 +0600 Subject: [PATCH] experimentally add uuid library --- core/build.gradle | 1 + .../com/insanusmokrassar/postssystem/core/utils/IdUtils.kt | 3 ++- .../insanusmokrassar/postssystem/core/utils/generateId.kt | 5 ----- gradle.properties | 1 + 4 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 core/src/jvm8Main/kotlin/com/insanusmokrassar/postssystem/core/utils/generateId.kt diff --git a/core/build.gradle b/core/build.gradle index 2c4cf230..ec53fe4e 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -36,6 +36,7 @@ kotlin { api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$kotlin_serialisation_runtime_version" api "com.soywiz.korlibs.klock:klock:$klockVersion" + api "com.benasher44:uuid:$uuidVersion" } } jvm8Main { diff --git a/core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt b/core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt index 71d8f087..7b8fb658 100644 --- a/core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt +++ b/core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/utils/IdUtils.kt @@ -1,9 +1,10 @@ package com.insanusmokrassar.postssystem.core.utils +import com.benasher44.uuid.uuid4 import com.insanusmokrassar.postssystem.core.content.ContentId import com.insanusmokrassar.postssystem.core.post.PostId -internal expect fun generateId(): String +private fun generateId() = uuid4().toString() internal fun generatePostId(): PostId = generateId() internal fun generateContentId(): ContentId = generateId() diff --git a/core/src/jvm8Main/kotlin/com/insanusmokrassar/postssystem/core/utils/generateId.kt b/core/src/jvm8Main/kotlin/com/insanusmokrassar/postssystem/core/utils/generateId.kt deleted file mode 100644 index 31083323..00000000 --- a/core/src/jvm8Main/kotlin/com/insanusmokrassar/postssystem/core/utils/generateId.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.insanusmokrassar.postssystem.core.utils - -import java.util.* - -internal actual fun generateId(): String = UUID.randomUUID().toString() \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 9591bb70..f1cf3885 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,6 +4,7 @@ kotlin_coroutines_version=1.3.1 kotlin_serialisation_runtime_version=0.13.0 klockVersion=1.7.3 +uuidVersion=0.0.5 gradle_bintray_plugin_version=1.8.4