try new http client handler for icons

This commit is contained in:
Kyle Spearrin 2019-11-20 17:38:05 -05:00
parent 1da94bd9c8
commit c099f82752
2 changed files with 14 additions and 1 deletions

View file

@ -74,6 +74,7 @@
<Reference Include="Mono.Android.Export" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
</ItemGroup>

View file

@ -16,6 +16,7 @@ using Bit.Droid.Utilities;
using Plugin.CurrentActivity;
using Plugin.Fingerprint;
using Xamarin.Android.Net;
using System.Net.Http;
#if !FDROID
using Android.Gms.Security;
#endif
@ -78,7 +79,8 @@ namespace Bit.Droid
FFImageLoading.ImageService.Instance.Initialize(new FFImageLoading.Config.Configuration
{
FadeAnimationEnabled = false,
FadeAnimationForCachedImages = false
FadeAnimationForCachedImages = false,
HttpClient = new HttpClient(new AndroidHttpImageClientHandler())
});
ZXing.Net.Mobile.Forms.Android.Platform.Init();
});
@ -144,5 +146,15 @@ namespace Bit.Droid
Constants.DisableFaviconKey, disableFavicon);
await ServiceContainer.Resolve<IEnvironmentService>("environmentService").SetUrlsFromStorageAsync();
}
public class AndroidHttpImageClientHandler : HttpClientHandler
{
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
System.Threading.CancellationToken cancellationToken)
{
request.Version = new Version(1, 0);
return await base.SendAsync(request, cancellationToken);
}
}
}
}