summaryrefslogtreecommitdiffstats
path: root/lib/private/AppFramework
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-07-14 09:18:39 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-07-14 16:01:14 +0200
commitfa9dfd83c97e7b97c78003f40667e3e25db27400 (patch)
tree8268bbf1aef181f00ec7a51252800a13cf801d55 /lib/private/AppFramework
parent5dca062c975a7f4b3fbbef8f3b5354258255ec10 (diff)
downloadnextcloud-server-fa9dfd83c97e7b97c78003f40667e3e25db27400.tar.gz
nextcloud-server-fa9dfd83c97e7b97c78003f40667e3e25db27400.zip
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 <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/AppFramework')
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php16
1 files changed, 14 insertions, 2 deletions
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')
+ );
+ });
}
/**