diff --git a/.tool-versions b/.tool-versions index 5df105d..928fe3f 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ java openjdk-17 -ruby 3.2.1 +ruby 3.2.2 diff --git a/README.md b/README.md index 69afb21..b4cfd43 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@


A lightweight Kotlin Multiplatform library to monitor network state changes

- + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ee40916..e77ccb2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,16 +1,14 @@ [versions] -androidGradlePlugin = "8.1.1" +androidGradlePlugin = "8.2.0" androidxStartup = "1.1.1" -kotlin = "1.9.10" +kotlin = "1.9.21" kotlinxCoroutines = "1.7.3" [libraries] kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" } -kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" } androidx-startup-runtime = { module = "androidx.startup:startup-runtime", version.ref = "androidxStartup" } [plugins] -android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41270dd..9712c06 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Aug 31 13:20:04 EDT 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/konnectivity/build.gradle.kts b/konnectivity/build.gradle.kts index 893788d..57c0193 100644 --- a/konnectivity/build.gradle.kts +++ b/konnectivity/build.gradle.kts @@ -13,7 +13,8 @@ kotlin { androidTarget { publishAllLibraryVariants() } - ios() + iosX64() + iosArm64() iosSimulatorArm64() js(IR) { nodejs() @@ -26,39 +27,24 @@ kotlin { } sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation(libs.kotlinx.coroutines.core) } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) } } - val androidMain by getting { + androidMain { dependencies { implementation(libs.androidx.startup.runtime) } } - val androidUnitTest by getting - val iosX64Main by getting - val iosArm64Main by getting - val iosSimulatorArm64Main by getting - val iosMain by getting { - iosSimulatorArm64Main.dependsOn(this) - } - val iosX64Test by getting - val iosArm64Test by getting - val iosSimulatorArm64Test by getting - val iosTest by getting { - iosSimulatorArm64Test.dependsOn(this) - } - - val jsMain by getting - val jsTest by getting { + jsTest { dependencies { implementation(kotlin("test-js")) } diff --git a/konnectivity/src/iosMain/kotlin/com/mirego/konnectivity/IosKonnectivity.kt b/konnectivity/src/iosMain/kotlin/com/mirego/konnectivity/IosKonnectivity.kt index 51513a9..a543466 100644 --- a/konnectivity/src/iosMain/kotlin/com/mirego/konnectivity/IosKonnectivity.kt +++ b/konnectivity/src/iosMain/kotlin/com/mirego/konnectivity/IosKonnectivity.kt @@ -4,9 +4,11 @@ import cocoapods.Reachability.NetworkStatus import cocoapods.Reachability.Reachability import cocoapods.Reachability.ReachableViaWWAN import cocoapods.Reachability.ReachableViaWiFi +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.callbackFlow +@ExperimentalForeignApi internal class IosKonnectivity : Konnectivity { private val reachability: Reachability? by lazy { diff --git a/konnectivity/src/iosMain/kotlin/com/mirego/konnectivity/Konnectivity.kt b/konnectivity/src/iosMain/kotlin/com/mirego/konnectivity/Konnectivity.kt index b393852..6ea9072 100644 --- a/konnectivity/src/iosMain/kotlin/com/mirego/konnectivity/Konnectivity.kt +++ b/konnectivity/src/iosMain/kotlin/com/mirego/konnectivity/Konnectivity.kt @@ -1,3 +1,6 @@ package com.mirego.konnectivity +import kotlinx.cinterop.ExperimentalForeignApi + +@OptIn(ExperimentalForeignApi::class) actual fun Konnectivity(): Konnectivity = IosKonnectivity()