diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-07-16 17:08:03 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-07-21 20:43:18 +0200 |
commit | 91e7f12088cb87ffef5660429ece404364167978 (patch) | |
tree | baf44ebc7b240bd49eb0f6bf615cbb1ed99d13db /apps/systemtags | |
parent | e029055e766298c5852eedabf06ff42b06a50198 (diff) | |
download | nextcloud-server-91e7f12088cb87ffef5660429ece404364167978.tar.gz nextcloud-server-91e7f12088cb87ffef5660429ece404364167978.zip |
Adjust apps' code to use the ContainerInterface
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/systemtags')
-rw-r--r-- | apps/systemtags/lib/AppInfo/Application.php | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/apps/systemtags/lib/AppInfo/Application.php b/apps/systemtags/lib/AppInfo/Application.php index 45ac2dc1e84..ca18165680b 100644 --- a/apps/systemtags/lib/AppInfo/Application.php +++ b/apps/systemtags/lib/AppInfo/Application.php @@ -32,6 +32,7 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\SystemTag\ManagerEvent; use OCP\SystemTag\MapperEvent; +use Symfony\Component\EventDispatcher\EventDispatcher; class Application extends App implements IBootstrap { public const APP_ID = 'systemtags'; @@ -44,35 +45,36 @@ class Application extends App implements IBootstrap { } public function boot(IBootContext $context): void { - /* - * @todo move the OCP events and then move the registration to `register` - */ - $eventDispatcher = $context->getServerContainer()->getEventDispatcher(); - $eventDispatcher->addListener( - 'OCA\Files::loadAdditionalScripts', - function () { - // FIXME: no public API for these ? - \OCP\Util::addScript('dist/systemtags'); - \OCP\Util::addScript(self::APP_ID, 'systemtags'); - } - ); + $context->injectFn(function (EventDispatcher $dispatcher) use ($context) { + /* + * @todo move the OCP events and then move the registration to `register` + */ + $dispatcher->addListener( + 'OCA\Files::loadAdditionalScripts', + function () { + // FIXME: no public API for these ? + \OCP\Util::addScript('dist/systemtags'); + \OCP\Util::addScript(self::APP_ID, 'systemtags'); + } + ); - $managerListener = function (ManagerEvent $event) use ($context) { - /** @var \OCA\SystemTags\Activity\Listener $listener */ - $listener = $context->getServerContainer()->query(Listener::class); - $listener->event($event); - }; - $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); - $eventDispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); - $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); + $managerListener = function (ManagerEvent $event) use ($context) { + /** @var \OCA\SystemTags\Activity\Listener $listener */ + $listener = $context->getServerContainer()->query(Listener::class); + $listener->event($event); + }; + $dispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); + $dispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener); + $dispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); - $mapperListener = function (MapperEvent $event) use ($context) { - /** @var \OCA\SystemTags\Activity\Listener $listener */ - $listener = $context->getServerContainer()->query(Listener::class); - $listener->mapperEvent($event); - }; - $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); - $eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); + $mapperListener = function (MapperEvent $event) use ($context) { + /** @var \OCA\SystemTags\Activity\Listener $listener */ + $listener = $context->getServerContainer()->query(Listener::class); + $listener->mapperEvent($event); + }; + $dispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); + $dispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); + }); \OCA\Files\App::getNavigationManager()->add(function () { $l = \OC::$server->getL10N(self::APP_ID); |