From c099f827522e726dc2f3f1b5a335ccc5804d12d8 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 20 Nov 2019 17:38:05 -0500 Subject: [PATCH] try new http client handler for icons --- src/Android/Android.csproj | 1 + src/Android/MainApplication.cs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index b5f3a740d..516b32b69 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -74,6 +74,7 @@ + diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs index 0460641e5..5fe22c688 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -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("environmentService").SetUrlsFromStorageAsync(); } + + public class AndroidHttpImageClientHandler : HttpClientHandler + { + protected override async Task SendAsync(HttpRequestMessage request, + System.Threading.CancellationToken cancellationToken) + { + request.Version = new Version(1, 0); + return await base.SendAsync(request, cancellationToken); + } + } } }