From 58b8b00798fcee45f355ec043483be50a352a6eb Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 29 Jun 2020 16:07:21 +0200 Subject: [PATCH] Use \OCP\IContainer::injectFn to boot the Accessibility app Signed-off-by: Christoph Wurst --- apps/accessibility/lib/AppInfo/Application.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/apps/accessibility/lib/AppInfo/Application.php b/apps/accessibility/lib/AppInfo/Application.php index 6d583af07f..9f596e460e 100644 --- a/apps/accessibility/lib/AppInfo/Application.php +++ b/apps/accessibility/lib/AppInfo/Application.php @@ -56,16 +56,11 @@ class Application extends App implements IBootstrap { } public function boot(IBootContext $context): void { - $this->injectCss( - $context->getAppContainer()->query(IUserSession::class), - $context->getAppContainer()->query(IConfig::class), - $context->getAppContainer()->query(IURLGenerator::class) - ); - - $this->registerInitialState($context->getAppContainer()); + $context->injectFn([$this, 'injectCss']); + $context->injectFn([$this, 'registerInitialState']); } - private function injectCss(IUserSession $userSession, + public function injectCss(IUserSession $userSession, IConfig $config, IURLGenerator $urlGenerator) { // Inject the fake css on all pages if enabled and user is logged @@ -87,10 +82,8 @@ class Application extends App implements IBootstrap { } } - private function registerInitialState(IAppContainer $container) { - /** @var IInitialStateService $initialState */ - $initialState = $container->query(IInitialStateService::class); - + public function registerInitialState(IInitialStateService $initialState, + IAppContainer $container) { $initialState->provideLazyInitialState(self::APP_ID, 'data', function () use ($container) { /** @var JSDataService $data */ $data = $container->query(JSDataService::class);