From 158ea47f5133676b22933769dc49be629e8df47b Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Wed, 30 Apr 2025 10:30:08 +0200 Subject: [PATCH] Class def not found error --- composeApp/build.gradle.kts | 5 ++++ .../kotlin/nl/lengrand/GreetingTest.kt | 7 ++++++ .../kotlin/nl/lengrand/Greeting.kt | 23 ++++++++++++++++++- .../kotlin/nl/lengrand/GreetingTest.kt | 8 +++++++ gradle/libs.versions.toml | 9 ++++++-- 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 72090ba..f5de7ac 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -4,6 +4,7 @@ plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.composeMultiplatform) alias(libs.plugins.composeCompiler) + alias(libs.plugins.serialization) } kotlin { @@ -34,6 +35,10 @@ kotlin { implementation(compose.components.uiToolingPreview) implementation(libs.androidx.lifecycle.viewmodel) implementation(libs.androidx.lifecycle.runtime.compose) + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0") + implementation(libs.kbsky.core) + + } desktopMain.dependencies { diff --git a/composeApp/src/desktopChainTest/kotlin/nl/lengrand/GreetingTest.kt b/composeApp/src/desktopChainTest/kotlin/nl/lengrand/GreetingTest.kt index 4709c39..9e47c1b 100644 --- a/composeApp/src/desktopChainTest/kotlin/nl/lengrand/GreetingTest.kt +++ b/composeApp/src/desktopChainTest/kotlin/nl/lengrand/GreetingTest.kt @@ -2,6 +2,8 @@ package nl.lengrand import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows +import work.socialhub.kbsky.ATProtocolException class GreetingTest { @Test @@ -10,4 +12,9 @@ class GreetingTest { assertEquals("Hello, you!", Greeting().greet()) } + @Test + fun connect(){ + assertThrows { Greeting().connect() } + + } } \ No newline at end of file diff --git a/composeApp/src/desktopMain/kotlin/nl/lengrand/Greeting.kt b/composeApp/src/desktopMain/kotlin/nl/lengrand/Greeting.kt index 7533f4e..8b99dc9 100644 --- a/composeApp/src/desktopMain/kotlin/nl/lengrand/Greeting.kt +++ b/composeApp/src/desktopMain/kotlin/nl/lengrand/Greeting.kt @@ -1,9 +1,30 @@ package nl.lengrand +import kotlinx.serialization.Serializable +import work.socialhub.kbsky.BlueskyFactory +import work.socialhub.kbsky.api.entity.com.atproto.server.ServerCreateSessionRequest +import work.socialhub.kbsky.domain.Service + +@Serializable +data class User (val name: String) + class Greeting { private val platform = getPlatform() fun greet(): String { - return "Hello, you!" + return "Hello, ${User("you").name}!" } + + fun connect(){ + val response = BlueskyFactory + .instance(Service.BSKY_SOCIAL.uri) + .server() + .createSession( + ServerCreateSessionRequest().also { + it.identifier = "test" + it.password = "tests" + } + ) + + println(response.data.accessJwt)} } \ No newline at end of file diff --git a/composeApp/src/desktopTest/kotlin/nl/lengrand/GreetingTest.kt b/composeApp/src/desktopTest/kotlin/nl/lengrand/GreetingTest.kt index 4709c39..95b15fa 100644 --- a/composeApp/src/desktopTest/kotlin/nl/lengrand/GreetingTest.kt +++ b/composeApp/src/desktopTest/kotlin/nl/lengrand/GreetingTest.kt @@ -2,6 +2,8 @@ package nl.lengrand import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows +import work.socialhub.kbsky.ATProtocolException class GreetingTest { @Test @@ -10,4 +12,10 @@ class GreetingTest { assertEquals("Hello, you!", Greeting().greet()) } + @Test + fun connect(){ + assertThrows { Greeting().connect() } + + } + } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3281531..64a640a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,9 +3,10 @@ androidx-lifecycle = "2.8.4" compose-multiplatform = "1.7.3" junit = "4.13.2" junit5 = "5.8.1" - kotlin = "2.1.20" kotlinx-coroutines = "1.10.2" +serialization = "1.8.0" +kbsky = "0.3.0" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } @@ -15,8 +16,12 @@ junit5 = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.r androidx-lifecycle-viewmodel = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-viewmodel", version.ref = "androidx-lifecycle" } androidx-lifecycle-runtime-compose = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidx-lifecycle" } kotlinx-coroutines-swing = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } +serialization = {group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization"} +kbsky-core = { module = "work.socialhub.kbsky:core", version.ref = "kbsky" } + [plugins] composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" } composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } -kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } \ No newline at end of file +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } \ No newline at end of file