Skip to content

Commit

Permalink
Merge pull request #491 from nitoclub/feature/GH-249
Browse files Browse the repository at this point in the history
feat: imageLoader -> coil
  • Loading branch information
tatsutakein authored Sep 18, 2024
2 parents fe62ba7 + 7233405 commit f3253ee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
3 changes: 2 additions & 1 deletion core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ kotlin {
dependencies {
implementation(compose.components.resources)
implementation(compose.materialIconsExtended)
api(libs.imageLoader)
api(libs.coil)
api(libs.coilNetwork)
}
}
}
Expand Down
14 changes: 5 additions & 9 deletions core/ui/src/commonMain/kotlin/club/nito/core/ui/ProfileImage.kt
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
package club.nito.core.ui

import androidx.compose.foundation.Image
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import club.nito.core.designsystem.icon.NitoIcons
import club.nito.core.model.UserProfile
import com.seiko.imageloader.rememberImagePainter
import coil3.compose.AsyncImage

@Composable
public fun ProfileImage(
profile: UserProfile,
modifier: Modifier = Modifier,
) {
if (profile.avatarUrl.isNotBlank()) {
Image(
painter = rememberImagePainter(
url = profile.avatarUrl,
),
AsyncImage(
model = profile.avatarUrl,
contentDescription = profile.displayName,
contentScale = ContentScale.Crop,
modifier = modifier.clip(CircleShape),
)
} else {
Icon(
imageVector = NitoIcons.AccountCircle,
AsyncImage(
model = NitoIcons.AccountCircle,
contentDescription = profile.displayName,
modifier = modifier,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package club.nito.feature.schedule.detail

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
Expand Down Expand Up @@ -60,7 +59,7 @@ import club.nito.core.model.schedule.ScheduleWithPlace
import club.nito.core.ui.ProfileImage
import club.nito.core.ui.koinStateMachine
import club.nito.core.ui.message.SnackbarMessageEffect
import com.seiko.imageloader.rememberImagePainter
import coil3.compose.AsyncImage
import org.koin.core.parameter.parametersOf

@Composable
Expand Down Expand Up @@ -243,10 +242,8 @@ private fun VenueSection(
.fillMaxWidth()
.heightIn(max = 200.dp),
) {
Image(
painter = rememberImagePainter(
url = schedule.venue.imageUrl,
),
AsyncImage(
model = schedule.venue.imageUrl,
modifier = Modifier.fillMaxWidth(),
contentScale = ContentScale.FillWidth,
contentDescription = null,
Expand Down Expand Up @@ -307,10 +304,8 @@ private fun MeetSection(
.fillMaxWidth()
.heightIn(max = 200.dp),
) {
Image(
painter = rememberImagePainter(
url = schedule.meet.imageUrl,
),
AsyncImage(
model = schedule.meet.imageUrl,
modifier = Modifier.fillMaxWidth(),
contentScale = ContentScale.FillWidth,
contentDescription = null,
Expand Down
6 changes: 4 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ logback = "1.5.8"
graphqlKotlin = "7.1.5"
kotest = "5.9.1"
precompose = "1.6.2"
imageLoader = "1.8.3"
coil = "3.0.0-alpha10"

[libraries]
androidGradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
Expand Down Expand Up @@ -65,7 +65,9 @@ kotlinxCollectionsImmutable = { module = "org.jetbrains.kotlinx:kotlinx-collecti
kotlinxDatetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version = "0.6.1" }
kotlinxAtomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version = "0.25.0" }

imageLoader = { module = "io.github.qdsfdhvh:image-loader", version.ref = "imageLoader" }
coil = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil" }
coilNetwork = { module = "io.coil-kt.coil3:coil-network-ktor2", version.ref = "coil" }
coilTest = { module = "io.coil-kt.coil3:coil-test", version.ref = "coil" }

androidxActivityActivityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidxActivity" }
androidxDatastoreDatastorePreferences = { module = "androidx.datastore:datastore-preferences-core", version = "1.1.1" }
Expand Down

0 comments on commit f3253ee

Please sign in to comment.