Skip to content

Commit

Permalink
Change emplacement where svg is used
Browse files Browse the repository at this point in the history
Change emplacement so we don't import the coil svg lib everywhere, only in mail
  • Loading branch information
NicolasBourdin88 committed Jun 24, 2024
1 parent dc39386 commit 385862a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ dependencies {

implementation libs.sentry.android.fragment

implementation libs.coil.svg

// Test
testImplementation libs.junit
androidTestImplementation libs.ext.junit
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/infomaniak/mail/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.work.Configuration
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.decode.SvgDecoder
import com.facebook.stetho.Stetho
import com.infomaniak.lib.core.InfomaniakCore
import com.infomaniak.lib.core.auth.TokenInterceptorListener
Expand Down Expand Up @@ -275,7 +276,11 @@ open class MainApplication : Application(), ImageLoaderFactory, DefaultLifecycle
}

fun createSvgImageLoader(): ImageLoader {
return CoilUtils.newImageLoader(applicationContext, tokenInterceptorListener(), isSvg = true)
return CoilUtils.newImageLoader(
applicationContext,
tokenInterceptorListener(),
customComponents = listOf(SvgDecoder.Factory())
)
}

companion object {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ sentryAndroidFragment = "7.10.0"
webkit = "1.11.0"
workConcurrentFutures = "1.1.0"
workRuntimeKtx = "2.9.0"
coilSvg = "2.6.0"

[libraries]
dotsindicator = { module = "com.tbuonomo:dotsindicator", version.ref = "dotsindicator" }
Expand All @@ -43,6 +44,7 @@ sentry-android-fragment = { module = "io.sentry:sentry-android-fragment", versio
webkit = { module = "androidx.webkit:webkit", version.ref = "webkit" }
work-concurrent-futures = { module = "androidx.concurrent:concurrent-futures-ktx", version.ref = "workConcurrentFutures" }
work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workRuntimeKtx" }
coil-svg = { module = "io.coil-kt:coil-svg", version.ref = "coilSvg" }
# Unit tests
ext-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
junit = { module = "junit:junit", version.ref = "junit" }
Expand Down

0 comments on commit 385862a

Please sign in to comment.