From fa9dfd83c97e7b97c78003f40667e3e25db27400 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 14 Jul 2020 09:18:39 +0200 Subject: Fix AppFramework services * We can't just register an alias as the services need the appId to be injected. if we just register an alias this blows up since the main container doesn't have the appId. * Moved the Authtokens over to show the PoC works Signed-off-by: Roeland Jago Douma --- .../AppFramework/DependencyInjection/DIContainer.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/private/AppFramework/DependencyInjection') diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 82a2780eb27..bda014838ed 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -59,6 +59,8 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\Folder; use OCP\Files\IAppData; use OCP\Group\ISubAdmin; +use OCP\IConfig; +use OCP\IInitialStateService; use OCP\IL10N; use OCP\ILogger; use OCP\INavigationManager; @@ -295,8 +297,18 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $dispatcher; }); - $this->registerAlias(IAppConfig::class, OC\AppFramework\Services\AppConfig::class); - $this->registerAlias(IInitialState::class, OC\AppFramework\Services\InitialState::class); + $this->registerService(IAppConfig::class, function (SimpleContainer $c) { + return new OC\AppFramework\Services\AppConfig( + $c->query(IConfig::class), + $c->query('AppName') + ); + }); + $this->registerService(IInitialState::class, function (SimpleContainer $c) { + return new OC\AppFramework\Services\InitialState( + $c->query(IInitialStateService::class), + $c->query('AppName') + ); + }); } /** -- cgit v1.2.3