Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically retry image requests after regaining network connectivity #132

Open
ismailnurudeen opened this issue Sep 30, 2019 · 9 comments
Labels
enhancement New feature or request

Comments

@ismailnurudeen
Copy link

I am using the code below to load images from a URL into the target imageview
When i try to load the images without internet connection,the error image is displayed,then if i turn on internet connection,unlike Glide, Coil doesn't try to reload the images from the URL.

 fun loadImageWithCoil(
        target: ImageView,
        imgUrl: String?,
        placeHolder: Int = R.drawable.profile_pic_placeholder,
        errorImg:Int=R.drawable.ic_terrain_black_24dp
    ) {
        target.load(imgUrl) {
            placeholder(placeHolder)
            crossfade(true)
            error(errorImg)
        }

    }

Is this currently not possible or I'm not doing it right?.

@colinrtwhite
Copy link
Member

colinrtwhite commented Sep 30, 2019

Yep, this is currently not implemented. Coil will automatically force reading from the disk cache if you're offline, but it won't restart a request when you come back online.

@colinrtwhite colinrtwhite added the enhancement New feature or request label Sep 30, 2019
@ismailnurudeen
Copy link
Author

Is there a reason associated with Coil's nature or performance why this is currently not implemented or it's something we should be expecting soon?

@colinrtwhite
Copy link
Member

@ElNuru247 I think this could be implemented, though it's low priority. I've shied away from adding it so far as I'm not sure how much complexity it would add to Coil.

@colinrtwhite colinrtwhite changed the title Coil does not automatically reloads image after internet reconnection Automatically retry image requests after regaining network connectivity Oct 1, 2019
@mario
Copy link
Contributor

mario commented Oct 14, 2019

I would assume "lots". Network connectivity is different from being able to load something from network for various reasons.

@magnumrocha
Copy link

Any progress on this point? or anybody here has some workaround for this use case?

I am using Coil to show an image library (from the internet) on a RecyclerView, and I would like to refresh the images not loaded when the device regaining network connectivity.

@ShowMeThe
Copy link

Is there possible to retry the failed net-work request delay after 1s or 3s or notify the failed request when net-work switch WIFI from 4G or switch 4G from WIFI if the view or the lifecycle is still alive ? I do think that the way to automatically retry image requests after regaining network connectivity is not easy to solve it , because the net-work has complicated situation .

@ouattararomuald
Copy link

Fresco has tap to reload (after a failure). Maybe coil can do the same ?

@Obolrom
Copy link

Obolrom commented Mar 4, 2023

@colinrtwhite, hi. Any updates on this issue?

@hamid97m
Copy link

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants