From e14199116645a97a696df34461c72782ee138761 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 18 Apr 2019 12:31:35 -0400 Subject: [PATCH] bootstrap --- src/Android/MainApplication.cs | 17 ++++++++++++++++- src/Core/Abstractions/IAuthService.cs | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs index 8deb40488..8df498f04 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Threading.Tasks; using Android.App; using Android.Runtime; using Bit.App.Abstractions; @@ -32,10 +33,11 @@ namespace Bit.Droid public override void OnCreate() { base.OnCreate(); + Bootstrap(); Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this); } - public void RegisterLocalServices() + private void RegisterLocalServices() { var preferencesStorage = new PreferencesStorageService(null); var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); @@ -58,5 +60,18 @@ namespace Bit.Droid ServiceContainer.Register("deviceActionService", deviceActionService); ServiceContainer.Register("platformUtilsService", platformUtilsService); } + + private void Bootstrap() + { + (ServiceContainer.Resolve("i18nService") as MobileI18nService).Init(); + ServiceContainer.Resolve("authService").Init(); + // Note: This is not awaited + var bootstrapTask = BootstrapAsync(); + } + + private async Task BootstrapAsync() + { + await ServiceContainer.Resolve("environmentService").SetUrlsFromStorageAsync(); + } } } \ No newline at end of file diff --git a/src/Core/Abstractions/IAuthService.cs b/src/Core/Abstractions/IAuthService.cs index c2c7e3c67..83b575314 100644 --- a/src/Core/Abstractions/IAuthService.cs +++ b/src/Core/Abstractions/IAuthService.cs @@ -19,5 +19,6 @@ namespace Bit.Core.Abstractions Task LogInCompleteAsync(string email, string masterPassword, TwoFactorProviderType twoFactorProvider, string twoFactorToken, bool? remember = null); Task LogInTwoFactorAsync(TwoFactorProviderType twoFactorProvider, string twoFactorToken, bool? remember = null); void LogOut(Action callback); + void Init(); } } \ No newline at end of file