1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-23 11:45:38 +01:00

EC-833 fix WatchDeviceService registration to be called from the extensions appropiately (#2233)

This commit is contained in:
Federico Maccaroni 2022-12-13 11:27:15 -03:00 committed by GitHub
parent 1a3ff5ec41
commit 28d204f2b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View File

@ -404,6 +404,7 @@ namespace Bit.iOS.Autofill
ServiceContainer.Init(deviceActionService.DeviceUserAgent, ServiceContainer.Init(deviceActionService.DeviceUserAgent,
Bit.Core.Constants.iOSAutoFillClearCiphersCacheKey, Bit.Core.Constants.iOSAllClearCipherCacheKeys); Bit.Core.Constants.iOSAutoFillClearCiphersCacheKey, Bit.Core.Constants.iOSAllClearCipherCacheKeys);
iOSCoreHelpers.InitLogger(); iOSCoreHelpers.InitLogger();
iOSCoreHelpers.RegisterFinallyBeforeBootstrap();
iOSCoreHelpers.Bootstrap(); iOSCoreHelpers.Bootstrap();
var appOptions = new AppOptions { IosExtension = true }; var appOptions = new AppOptions { IosExtension = true };
var app = new App.App(appOptions); var app = new App.App(appOptions);

View File

@ -49,10 +49,7 @@ namespace Bit.iOS.Core.Utilities
Bit.Core.Constants.iOSAllClearCipherCacheKeys); Bit.Core.Constants.iOSAllClearCipherCacheKeys);
InitLogger(); InitLogger();
ServiceContainer.Register<IWatchDeviceService>(new WatchDeviceService(ServiceContainer.Resolve<ICipherService>(), RegisterFinallyBeforeBootstrap();
ServiceContainer.Resolve<IEnvironmentService>(),
ServiceContainer.Resolve<IStateService>(),
ServiceContainer.Resolve<IVaultTimeoutService>()));
Bootstrap(); Bootstrap();
@ -139,6 +136,14 @@ namespace Bit.iOS.Core.Utilities
ServiceContainer.Register<IAvatarImageSourcePool>("avatarImageSourcePool", new AvatarImageSourcePool()); ServiceContainer.Register<IAvatarImageSourcePool>("avatarImageSourcePool", new AvatarImageSourcePool());
} }
public static void RegisterFinallyBeforeBootstrap()
{
ServiceContainer.Register<IWatchDeviceService>(new WatchDeviceService(ServiceContainer.Resolve<ICipherService>(),
ServiceContainer.Resolve<IEnvironmentService>(),
ServiceContainer.Resolve<IStateService>(),
ServiceContainer.Resolve<IVaultTimeoutService>()));
}
public static void Bootstrap(Func<Task> postBootstrapFunc = null) public static void Bootstrap(Func<Task> postBootstrapFunc = null)
{ {
(ServiceContainer.Resolve<II18nService>("i18nService") as MobileI18nService).Init(); (ServiceContainer.Resolve<II18nService>("i18nService") as MobileI18nService).Init();

View File

@ -408,6 +408,7 @@ namespace Bit.iOS.Extension
ServiceContainer.Init(deviceActionService.DeviceUserAgent, ServiceContainer.Init(deviceActionService.DeviceUserAgent,
Bit.Core.Constants.iOSExtensionClearCiphersCacheKey, Bit.Core.Constants.iOSAllClearCipherCacheKeys); Bit.Core.Constants.iOSExtensionClearCiphersCacheKey, Bit.Core.Constants.iOSAllClearCipherCacheKeys);
iOSCoreHelpers.InitLogger(); iOSCoreHelpers.InitLogger();
iOSCoreHelpers.RegisterFinallyBeforeBootstrap();
iOSCoreHelpers.Bootstrap(); iOSCoreHelpers.Bootstrap();
var app = new App.App(new AppOptions { IosExtension = true }); var app = new App.App(new AppOptions { IosExtension = true });
ThemeManager.SetTheme(app.Resources); ThemeManager.SetTheme(app.Resources);

View File

@ -306,11 +306,7 @@ namespace Bit.iOS
ServiceContainer.Init(deviceActionService.DeviceUserAgent, Constants.ClearCiphersCacheKey, ServiceContainer.Init(deviceActionService.DeviceUserAgent, Constants.ClearCiphersCacheKey,
Constants.iOSAllClearCipherCacheKeys); Constants.iOSAllClearCipherCacheKeys);
iOSCoreHelpers.InitLogger(); iOSCoreHelpers.InitLogger();
iOSCoreHelpers.RegisterFinallyBeforeBootstrap();
ServiceContainer.Register<IWatchDeviceService>(new WatchDeviceService(ServiceContainer.Resolve<ICipherService>(),
ServiceContainer.Resolve<IEnvironmentService>(),
ServiceContainer.Resolve<IStateService>(),
ServiceContainer.Resolve<IVaultTimeoutService>()));
_pushHandler = new iOSPushNotificationHandler( _pushHandler = new iOSPushNotificationHandler(
ServiceContainer.Resolve<IPushNotificationListenerService>("pushNotificationListenerService")); ServiceContainer.Resolve<IPushNotificationListenerService>("pushNotificationListenerService"));