You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I saw 2 closed PRs when with this feature, would really appreciate to hear today's team's vision on this matter.
Bringing some thoughts:
A real-world serious app would (personal bet and exp) include http extensions nuget to use httpfactory for intensive API calls. Not to include it targeting light demo app cases is a debatable choice for me.
Platform implementations like Android Glide should not limit the shared code to become more robust and modern, but should adapt to it. At the same time we can just omit http extensions for Android and think of a way to provide a fancy Glide builder customization method.
Lyrics:
For me this issue became an obvious problem for me when I got app to build where I had like 50% of images not loading, URLs were provided by third-party API. The cause was found to be that those URLs were coming from wiki that required UserAgent to be specified in client headers.
Created some example code for the discussion.
I used <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.4" /> to add retry policy to image source.
One of the tests demonstrate how one could customize the client, we allow access to builder too:
This extension method is intended to be public.
To marry Glide with this, would think of providing a platform-conditional delegate code allowing to customize Glide builder in a same way we could allow with the IHttpCLientBuilder.
Description
Provide a way to customize the
HttpClient
(or possible theHttpClientHandler
) used onUIrImageSource
here:maui/src/Controls/src/Core/UriImageSource.cs
Line 117 in abada83
Public API Changes
I'm not sure of the best API shape.
Unsealing
UriImageSource
and changingDownloadStreamAsync
to beprotected virtual
would be one solution.Getting
HttpClient
from theIServiceCollection
would be a bigger change (or changing to useIHttpClientFactory
).Intended Use-Case
My main requirement is the ability to add custom headers when using HTTP sourced images.
The text was updated successfully, but these errors were encountered: