diff --git a/.gitignore b/.gitignore index 5071c2e4..a8b82810 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ local.properties .idea/* !.idea/icon.png -.kotlin +.kotlin/ .DS_Store build/ captures diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index c89bf801..0fd3c661 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -257,6 +257,8 @@ dependencies { // Image loading implementation(libs.coil.svg) + implementation(libs.coil.network) + implementation(libs.ktor.client.okhttp) // SQLDelight implementation(libs.sqldelight.androidDriver) diff --git a/android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/KSApp.kt b/android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/KSApp.kt index 443b2d25..673650ce 100644 --- a/android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/KSApp.kt +++ b/android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/KSApp.kt @@ -1,14 +1,15 @@ package io.github.reactivecircus.kstreamlined.android import android.app.Application -import coil.ImageLoader -import coil.ImageLoaderFactory +import coil3.ImageLoader +import coil3.PlatformContext +import coil3.SingletonImageLoader import com.google.firebase.crashlytics.FirebaseCrashlytics import dagger.hilt.android.HiltAndroidApp import javax.inject.Inject @HiltAndroidApp -open class KSApp : Application(), ImageLoaderFactory { +open class KSApp : Application(), SingletonImageLoader.Factory { @Inject lateinit var imageLoader: ImageLoader @@ -29,5 +30,5 @@ open class KSApp : Application(), ImageLoaderFactory { // TODO } - override fun newImageLoader(): ImageLoader = imageLoader + override fun newImageLoader(context: PlatformContext): ImageLoader = imageLoader } diff --git a/android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/di/AppModule.kt b/android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/di/AppModule.kt index 44bd1525..650ff294 100644 --- a/android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/di/AppModule.kt +++ b/android/app/src/main/java/io/github/reactivecircus/kstreamlined/android/di/AppModule.kt @@ -2,8 +2,12 @@ package io.github.reactivecircus.kstreamlined.android.di import android.content.Context import android.os.Build -import coil.ImageLoader -import coil.decode.SvgDecoder +import coil3.ImageLoader +import coil3.annotation.ExperimentalCoilApi +import coil3.decode.SvgDecoder +import coil3.fetch.NetworkFetcher +import coil3.request.allowHardware +import coil3.request.crossfade import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -20,6 +24,8 @@ object AppModule { fun imageLoader(@ApplicationContext context: Context): ImageLoader { return ImageLoader.Builder(context) .components { + @OptIn(ExperimentalCoilApi::class) + add(NetworkFetcher.Factory()) add(SvgDecoder.Factory()) } .crossfade(enable = true) diff --git a/android/common-ui/feed/build.gradle.kts b/android/common-ui/feed/build.gradle.kts index 9ca49dc9..581e4b37 100644 --- a/android/common-ui/feed/build.gradle.kts +++ b/android/common-ui/feed/build.gradle.kts @@ -23,5 +23,5 @@ dependencies { implementation(libs.androidx.compose.ui.tooling) // Image loading - implementation(libs.coil) + implementation(libs.coil.compose) } diff --git a/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinBlogCard.kt b/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinBlogCard.kt index 3dfb4d4f..bdfa9fd4 100644 --- a/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinBlogCard.kt +++ b/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinBlogCard.kt @@ -15,7 +15,7 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage +import coil3.compose.AsyncImage import io.github.reactivecircus.kstreamlined.android.designsystem.component.IconButton import io.github.reactivecircus.kstreamlined.android.designsystem.component.Surface import io.github.reactivecircus.kstreamlined.android.designsystem.component.Text diff --git a/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinYouTubeCard.kt b/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinYouTubeCard.kt index 7e1cde65..06bf1498 100644 --- a/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinYouTubeCard.kt +++ b/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/KotlinYouTubeCard.kt @@ -23,7 +23,7 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage +import coil3.compose.AsyncImage import io.github.reactivecircus.kstreamlined.android.designsystem.component.Icon import io.github.reactivecircus.kstreamlined.android.designsystem.component.IconButton import io.github.reactivecircus.kstreamlined.android.designsystem.component.Surface diff --git a/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/TalkingKotlinCard.kt b/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/TalkingKotlinCard.kt index 725f3993..388cd51c 100644 --- a/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/TalkingKotlinCard.kt +++ b/android/common-ui/feed/src/main/java/io/github/reactivecircus/kstreamlined/android/common/ui/feed/TalkingKotlinCard.kt @@ -31,7 +31,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import coil.compose.AsyncImage +import coil3.compose.AsyncImage import io.github.reactivecircus.kstreamlined.android.designsystem.component.IconButton import io.github.reactivecircus.kstreamlined.android.designsystem.component.Surface import io.github.reactivecircus.kstreamlined.android.designsystem.component.Text diff --git a/android/feature/common/build.gradle.kts b/android/feature/common/build.gradle.kts index 7e42a2f0..e37fb5c5 100644 --- a/android/feature/common/build.gradle.kts +++ b/android/feature/common/build.gradle.kts @@ -32,7 +32,7 @@ dependencies { implementation(libs.androidx.browser) // Image loading - api(libs.coil) + api(libs.coil.compose) // Logging api(libs.kermit) diff --git a/android/feature/home/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/home/HomeScreen.kt b/android/feature/home/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/home/HomeScreen.kt index 7ccdfa2b..ae2144e1 100644 --- a/android/feature/home/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/home/HomeScreen.kt +++ b/android/feature/home/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/home/HomeScreen.kt @@ -34,7 +34,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage +import coil3.compose.AsyncImage import io.github.reactivecircus.kstreamlined.android.common.ui.feed.KotlinBlogCard import io.github.reactivecircus.kstreamlined.android.common.ui.feed.KotlinWeeklyCard import io.github.reactivecircus.kstreamlined.android.common.ui.feed.KotlinYouTubeCard diff --git a/android/feature/kotlin-weekly-issue/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/kotlinweeklyissue/KotlinWeeklyIssueScreen.kt b/android/feature/kotlin-weekly-issue/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/kotlinweeklyissue/KotlinWeeklyIssueScreen.kt index 30d70af7..4faf6379 100644 --- a/android/feature/kotlin-weekly-issue/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/kotlinweeklyissue/KotlinWeeklyIssueScreen.kt +++ b/android/feature/kotlin-weekly-issue/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/kotlinweeklyissue/KotlinWeeklyIssueScreen.kt @@ -36,7 +36,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.zIndex import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel -import coil.compose.AsyncImage +import coil3.compose.AsyncImage import io.github.reactivecircus.kstreamlined.android.designsystem.component.Button import io.github.reactivecircus.kstreamlined.android.designsystem.component.FilledIconButton import io.github.reactivecircus.kstreamlined.android.designsystem.component.LargeIconButton diff --git a/android/feature/saved-for-later/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/savedforlater/SavedForLaterScreen.kt b/android/feature/saved-for-later/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/savedforlater/SavedForLaterScreen.kt index 253623f3..f5959017 100644 --- a/android/feature/saved-for-later/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/savedforlater/SavedForLaterScreen.kt +++ b/android/feature/saved-for-later/src/main/java/io/github/reactivecircus/kstreamlined/android/feature/savedforlater/SavedForLaterScreen.kt @@ -23,7 +23,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage +import coil3.compose.AsyncImage import io.github.reactivecircus.kstreamlined.android.common.ui.feed.KotlinBlogCard import io.github.reactivecircus.kstreamlined.android.common.ui.feed.KotlinWeeklyCard import io.github.reactivecircus.kstreamlined.android.common.ui.feed.KotlinYouTubeCard diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c3add9fe..e530ec98 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -36,7 +36,8 @@ androidx-browser="1.8.0-beta01" androidx-profileinstaller = "1.3.1" androidx-benchmark = "1.2.2" androidx-metrics = "1.0.0-alpha04" -coil = "2.5.0" +coil = "3.0.0-alpha01" +ktor = "2.3.7" kermit = "2.0.2" sqldelight = "2.0.1" turbine = "1.0.0" @@ -86,8 +87,10 @@ androidx-browser = { module = "androidx.browser:browser", version.ref = "android androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "androidx-profileinstaller" } androidx-benchmark-macroJunit = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "androidx-benchmark" } androidx-metrics-performance = { module = "androidx.metrics:metrics-performance", version.ref = "androidx-metrics" } -coil = { module = "io.coil-kt:coil-compose", version.ref = "coil" } -coil-svg = { module = "io.coil-kt:coil-svg", version.ref = "coil" } +coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil" } +coil-network = { module = "io.coil-kt.coil3:coil-network", version.ref = "coil" } +coil-svg = { module = "io.coil-kt.coil3:coil-svg", version.ref = "coil" } +ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } apollo-runtime = { module = "com.apollographql.apollo3:apollo-runtime", version.ref = "apollo" } apollo-normalizedCache = { module = "com.apollographql.apollo3:apollo-normalized-cache", version.ref = "apollo" } apollo-adapters = { module = "com.apollographql.apollo3:apollo-adapters", version.ref = "apollo" }