Skip to content

Commit

Permalink
Revert fast initialization of Coil
Browse files Browse the repository at this point in the history
As discussed in coil-kt/coil#2097 the problem is caused by regitering system services, which will be fixed in 2.6.0

Change-Id: I9085309780508137f10b25ff82deed3c62e5d159
  • Loading branch information
mlykotom authored and dturner committed Feb 19, 2024
1 parent 7b168f8 commit 70ae77b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 69 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
package com.google.samples.apps.nowinandroid

import android.app.Application
import coil.Coil
import coil.ImageLoader
import coil.ImageLoaderFactory
import com.google.samples.apps.nowinandroid.sync.initializers.Sync
import com.google.samples.apps.nowinandroid.util.ImageLoaderAsyncFactory
import com.google.samples.apps.nowinandroid.util.ProfileVerifierLogger
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject
Expand All @@ -28,9 +28,9 @@ import javax.inject.Inject
* [Application] class for NiA
*/
@HiltAndroidApp
class NiaApplication : Application() {
class NiaApplication : Application(), ImageLoaderFactory {
@Inject
lateinit var imageLoaderAsyncFactory: ImageLoaderAsyncFactory
lateinit var imageLoader: dagger.Lazy<ImageLoader>

@Inject
lateinit var profileVerifierLogger: ProfileVerifierLogger
Expand All @@ -40,7 +40,7 @@ class NiaApplication : Application() {
// Initialize Sync; the system responsible for keeping data in the app up to date.
Sync.initialize(context = this)
profileVerifierLogger()
// We set immediately Coil's image loader factory to prevent initialization with the first image.
Coil.setImageLoader(imageLoaderAsyncFactory)
}

override fun newImageLoader(): ImageLoader = imageLoader.get()
}

0 comments on commit 70ae77b

Please sign in to comment.