1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-14 23:33:34 +00:00

android http client handler

This commit is contained in:
Kyle Spearrin
2019-06-15 18:44:08 -04:00
parent 58ef292fa7
commit c50dee479a
5 changed files with 19 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ namespace Bit.Core.Services
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
private readonly HttpClient _httpClient = new HttpClient();
private readonly HttpClient _httpClient;
private readonly ITokenService _tokenService;
private readonly IPlatformUtilsService _platformUtilsService;
private readonly Func<bool, Task> _logoutCallbackAsync;
@@ -31,13 +31,22 @@ namespace Bit.Core.Services
public ApiService(
ITokenService tokenService,
IPlatformUtilsService platformUtilsService,
Func<bool, Task> logoutCallbackAsync)
Func<bool, Task> logoutCallbackAsync,
HttpMessageHandler httpMessageHandler = null)
{
_tokenService = tokenService;
_platformUtilsService = platformUtilsService;
_logoutCallbackAsync = logoutCallbackAsync;
var device = _platformUtilsService.GetDevice();
_deviceType = device.ToString();
if(httpMessageHandler != null)
{
_httpClient = new HttpClient(httpMessageHandler);
}
else
{
_httpClient = new HttpClient();
}
}
public bool UrlsSet { get; private set; }