diff --git a/src/iOS.Autofill/CredentialProviderViewController.cs b/src/iOS.Autofill/CredentialProviderViewController.cs index 930d8b673..921576bbd 100644 --- a/src/iOS.Autofill/CredentialProviderViewController.cs +++ b/src/iOS.Autofill/CredentialProviderViewController.cs @@ -404,6 +404,7 @@ namespace Bit.iOS.Autofill ServiceContainer.Init(deviceActionService.DeviceUserAgent, Bit.Core.Constants.iOSAutoFillClearCiphersCacheKey, Bit.Core.Constants.iOSAllClearCipherCacheKeys); iOSCoreHelpers.InitLogger(); + iOSCoreHelpers.RegisterFinallyBeforeBootstrap(); iOSCoreHelpers.Bootstrap(); var appOptions = new AppOptions { IosExtension = true }; var app = new App.App(appOptions); diff --git a/src/iOS.Core/Utilities/iOSCoreHelpers.cs b/src/iOS.Core/Utilities/iOSCoreHelpers.cs index 41afc0bfc..b97c73ccd 100644 --- a/src/iOS.Core/Utilities/iOSCoreHelpers.cs +++ b/src/iOS.Core/Utilities/iOSCoreHelpers.cs @@ -49,10 +49,7 @@ namespace Bit.iOS.Core.Utilities Bit.Core.Constants.iOSAllClearCipherCacheKeys); InitLogger(); - ServiceContainer.Register(new WatchDeviceService(ServiceContainer.Resolve(), - ServiceContainer.Resolve(), - ServiceContainer.Resolve(), - ServiceContainer.Resolve())); + RegisterFinallyBeforeBootstrap(); Bootstrap(); @@ -139,6 +136,14 @@ namespace Bit.iOS.Core.Utilities ServiceContainer.Register("avatarImageSourcePool", new AvatarImageSourcePool()); } + public static void RegisterFinallyBeforeBootstrap() + { + ServiceContainer.Register(new WatchDeviceService(ServiceContainer.Resolve(), + ServiceContainer.Resolve(), + ServiceContainer.Resolve(), + ServiceContainer.Resolve())); + } + public static void Bootstrap(Func postBootstrapFunc = null) { (ServiceContainer.Resolve("i18nService") as MobileI18nService).Init(); diff --git a/src/iOS.Extension/LoadingViewController.cs b/src/iOS.Extension/LoadingViewController.cs index debc634d7..80bc850ea 100644 --- a/src/iOS.Extension/LoadingViewController.cs +++ b/src/iOS.Extension/LoadingViewController.cs @@ -408,6 +408,7 @@ namespace Bit.iOS.Extension ServiceContainer.Init(deviceActionService.DeviceUserAgent, Bit.Core.Constants.iOSExtensionClearCiphersCacheKey, Bit.Core.Constants.iOSAllClearCipherCacheKeys); iOSCoreHelpers.InitLogger(); + iOSCoreHelpers.RegisterFinallyBeforeBootstrap(); iOSCoreHelpers.Bootstrap(); var app = new App.App(new AppOptions { IosExtension = true }); ThemeManager.SetTheme(app.Resources); diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index ef1544ea8..05f294df5 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -306,11 +306,7 @@ namespace Bit.iOS ServiceContainer.Init(deviceActionService.DeviceUserAgent, Constants.ClearCiphersCacheKey, Constants.iOSAllClearCipherCacheKeys); iOSCoreHelpers.InitLogger(); - - ServiceContainer.Register(new WatchDeviceService(ServiceContainer.Resolve(), - ServiceContainer.Resolve(), - ServiceContainer.Resolve(), - ServiceContainer.Resolve())); + iOSCoreHelpers.RegisterFinallyBeforeBootstrap(); _pushHandler = new iOSPushNotificationHandler( ServiceContainer.Resolve("pushNotificationListenerService"));