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:
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user