Skip to content

Commit

Permalink
Merge pull request #24 from ahmedre/coil3
Browse files Browse the repository at this point in the history
Migrate network images to coil3
  • Loading branch information
ahmedre authored May 10, 2024
2 parents 0ff8d6f + 855523d commit 5ee9663
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 111 deletions.
1 change: 0 additions & 1 deletion catalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ kotlin {

val androidMain by getting {
dependencies {
implementation(libs.coil.compose)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.ui.tooling.preview)
Expand Down
9 changes: 8 additions & 1 deletion design/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,31 @@ kotlin {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(libs.coil)
implementation(libs.coil.compose)
}
}

val androidMain by getting {
dependencies {
implementation(libs.coil.compose)
implementation(libs.coil.network.okhttp)
implementation(compose.uiTooling)
}
}

val desktopMain by getting {
resources.srcDir("src/commonRes")
dependencies {
implementation(libs.kotlinx.coroutines.swing)
implementation(libs.coil.network.okhttp)
}
}

val jsMain by getting {
dependencies {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(libs.coil.network.ktor)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.js)
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@
*/
package dev.helw.playground.sdui.design.component

import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import coil3.compose.LocalPlatformContext
import coil3.request.ImageRequest
import dev.helw.playground.sdui.design.core.SizeToken

@Composable
expect fun AsyncImage(url: String, contentDescription: String, size: SizeToken, modifier: Modifier)
fun AsyncImage(url: String, contentDescription: String, size: SizeToken, modifier: Modifier) {
coil3.compose.AsyncImage(
model = ImageRequest.Builder(LocalPlatformContext.current)
.data(url)
.build(),
contentDescription = contentDescription,
modifier = modifier.size(size.underlyingSize)
)
}

This file was deleted.

This file was deleted.

10 changes: 8 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
activity-compose = "1.9.0"
agp = "8.4.0"
androidx-material = "1.6.7"
coil-compose = "2.4.0"
coil = "3.0.0-alpha06"
coroutines = "1.8.1"
foundation = "1.6.7"
kotlin = "1.9.23"
kotlinx-serialization = "1.6.3"
Expand All @@ -25,14 +26,19 @@ androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling

androidx-navigation-compose = "androidx.navigation:navigation-compose:2.7.7"

kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "coroutines" }

ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-contentNegotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
ktor-serialization-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }

coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" }
coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" }
coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil" }
coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coil" }
coil-network-ktor = { module = "io.coil-kt.coil3:coil-network-ktor", version.ref = "coil" }

kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }

Expand Down
6 changes: 0 additions & 6 deletions sdui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ kotlin {
implementation(libs.kotlinx.serialization.json)
}
}

val androidMain by getting {
dependencies {
implementation(libs.coil.compose)
}
}
}
}

Expand Down

0 comments on commit 5ee9663

Please sign in to comment.