1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-22 03:03:46 +00:00

[PM-1576] Fix Race condition AccountsManager registration (#2434)

* PM-1576 Moved registration of AccountsManager to avoid race conditions with the app start. To do so, added ConditionedAwaiterManager so that it handles a task to be awaited or completed depending on the callers.

* PM-1576 Fix format

* PM-1576 Fix throw to preserve StackTrace
This commit is contained in:
Federico Maccaroni
2023-04-07 18:24:54 +01:00
committed by GitHub
parent e5ce1760a6
commit 1823efa0e5
7 changed files with 132 additions and 37 deletions

View File

@@ -33,6 +33,7 @@ namespace Bit.Core.Utilities
SearchService searchService = null;
var conditionedRunner = new ConditionedAwaiterManager();
var tokenService = new TokenService(stateService);
var apiService = new ApiService(tokenService, platformUtilsService, (extras) =>
{
@@ -82,12 +83,13 @@ namespace Bit.Core.Utilities
keyConnectorService, passwordGenerationService);
var exportService = new ExportService(folderService, cipherService, cryptoService);
var auditService = new AuditService(cryptoFunctionService, apiService);
var environmentService = new EnvironmentService(apiService, stateService);
var environmentService = new EnvironmentService(apiService, stateService, conditionedRunner);
var eventService = new EventService(apiService, stateService, organizationService, cipherService);
var userVerificationService = new UserVerificationService(apiService, platformUtilsService, i18nService,
cryptoService);
var usernameGenerationService = new UsernameGenerationService(cryptoService, apiService, stateService);
Register<IConditionedAwaiterManager>(conditionedRunner);
Register<ITokenService>("tokenService", tokenService);
Register<IApiService>("apiService", apiService);
Register<IAppIdService>("appIdService", appIdService);