Skip to content

Commit

Permalink
Merge pull request #472 from nextcloud/fix/cleanup-php-app-query
Browse files Browse the repository at this point in the history
Cleanup app init query
  • Loading branch information
skjnldsv authored Apr 16, 2020
2 parents b16ba3a + d8b59e3 commit 65fa6ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@

namespace OCA\Viewer\AppInfo;

\OC::$server->query(\OCA\Viewer\AppInfo\Application::class);
$app = \OC::$server->query(\OCA\Viewer\AppInfo\Application::class);
$app->register();
9 changes: 7 additions & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ class Application extends App {

public function __construct() {
parent::__construct(self::APP_ID);

// listen to sidebar loading event
}

public function register() {
$server = $this->getContainer()->getServer();

/** @var IEventDispatcher $eventDispatcher */
$eventDispatcher = $server->query(IEventDispatcher::class);

// Watch Viewer load event
$eventDispatcher->addServiceListener(LoadViewer::class, LoadViewerScript::class);
}
}

0 comments on commit 65fa6ee

Please sign in to comment.