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

Consider implementing an Android class like Coils NetworkObserver #7470

Open
yschimke opened this issue Oct 3, 2022 · 5 comments
Open

Consider implementing an Android class like Coils NetworkObserver #7470

yschimke opened this issue Oct 3, 2022 · 5 comments
Assignees
Labels
enhancement Feature not a bug
Milestone

Comments

@yschimke
Copy link
Collaborator

yschimke commented Oct 3, 2022

Coil monitors networks and shortcircuits requests when no available network. It's on by default so the strategy seems solid.

https://github.com/coil-kt/coil/blob/01d96431ef588c3da08cc7ef4afbd3eb8b50b175/coil-base/src/main/java/coil/network/NetworkObserver.kt

https://github.com/coil-kt/coil/blob/01d96431ef588c3da08cc7ef4afbd3eb8b50b175/coil-base/src/main/java/coil/util/SystemCallbacks.kt

@yschimke yschimke added the enhancement Feature not a bug label Oct 3, 2022
@swankjesse
Copy link
Member

I think this makes more sense at Coil’s layer vs. OkHttp’s?

One problem I have with guards like this is their data is necessarily incomplete. The only way to know for sure whether an HTTP request will succeed is to attempt it! The network status is stale the moment it returns, and it only knows what’s inside the calling host and not the state of the rest of the network.

I do think there’s utility in things like this at the application layer, where you can tell the user that they’re offline and that they should turn on WiFi or whatever.

@swankjesse swankjesse added this to the Icebox milestone Jan 29, 2023
@yschimke
Copy link
Collaborator Author

I think this is feasible in okhttp-android. And might solve the airplane type issues.

#3278

@yschimke
Copy link
Collaborator Author

@swankjesse I think #8200 makes this look more valuable.

@yschimke yschimke self-assigned this Feb 2, 2024
@yschimke
Copy link
Collaborator Author

yschimke commented Mar 15, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature not a bug
Projects
None yet
Development

No branches or pull requests

2 participants