1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-31 15:43:19 +00:00

action extension project

This commit is contained in:
Kyle Spearrin
2019-06-26 20:28:23 -04:00
parent a158021f46
commit 79746efa2d
33 changed files with 725 additions and 23 deletions

View File

@@ -8,7 +8,6 @@ using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
@@ -22,7 +21,7 @@ namespace Bit.Core.Services
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
private readonly HttpClient _httpClient;
private readonly HttpClient _httpClient = new HttpClient();
private readonly ITokenService _tokenService;
private readonly IPlatformUtilsService _platformUtilsService;
private readonly Func<bool, Task> _logoutCallbackAsync;
@@ -31,22 +30,13 @@ namespace Bit.Core.Services
public ApiService(
ITokenService tokenService,
IPlatformUtilsService platformUtilsService,
Func<bool, Task> logoutCallbackAsync,
HttpMessageHandler httpMessageHandler = null)
Func<bool, Task> logoutCallbackAsync)
{
_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; }

View File

@@ -2,7 +2,6 @@
using Bit.Core.Services;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
namespace Bit.Core.Utilities
@@ -12,7 +11,7 @@ namespace Bit.Core.Utilities
public static Dictionary<string, object> RegisteredServices { get; set; } = new Dictionary<string, object>();
public static bool Inited { get; set; }
public static void Init(HttpClientHandler httpClientHandler = null)
public static void Init()
{
if(Inited)
{
@@ -32,8 +31,7 @@ namespace Bit.Core.Utilities
var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService);
var cryptoService = new CryptoService(storageService, secureStorageService, cryptoFunctionService);
var tokenService = new TokenService(storageService);
var apiService = new ApiService(tokenService, platformUtilsService, (bool expired) => Task.FromResult(0),
httpClientHandler);
var apiService = new ApiService(tokenService, platformUtilsService, (bool expired) => Task.FromResult(0));
var appIdService = new AppIdService(storageService);
var userService = new UserService(storageService, tokenService);
var settingsService = new SettingsService(userService, storageService);