aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib/AppInfo/Application.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_versions/lib/AppInfo/Application.php')
-rw-r--r--apps/files_versions/lib/AppInfo/Application.php39
1 files changed, 34 insertions, 5 deletions
diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php
index 919a9b42d79..c5791f33d3a 100644
--- a/apps/files_versions/lib/AppInfo/Application.php
+++ b/apps/files_versions/lib/AppInfo/Application.php
@@ -25,24 +25,37 @@ namespace OCA\Files_Versions\AppInfo;
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
use OCA\DAV\Connector\Sabre\Principal;
+use OCA\Files_Versions\Capabilities;
+use OCA\Files_Versions\Listener\LoadAdditionalListener;
+use OCA\Files_Versions\Listener\LoadSidebarListener;
use OCA\Files_Versions\Versions\IVersionManager;
use OCA\Files_Versions\Versions\VersionManager;
+use OCA\Files_Versions\Hooks;
+use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCA\Files\Event\LoadSidebar;
use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer;
-use OCA\Files_Versions\Capabilities;
+use OCP\EventDispatcher\IEventDispatcher;
class Application extends App {
- public function __construct(array $urlParams = array()) {
- parent::__construct('files_versions', $urlParams);
+
+ const APP_ID = 'files_versions';
+
+ public function __construct(array $urlParams = []) {
+ parent::__construct(self::APP_ID, $urlParams);
$container = $this->getContainer();
+ $server = $container->getServer();
+
+ /** @var IEventDispatcher $newDispatcher */
+ $dispatcher = $server->query(IEventDispatcher::class);
- /*
+ /**
* Register capabilities
*/
$container->registerCapability(Capabilities::class);
- /*
+ /**
* Register $principalBackend for the DAV collection
*/
$container->registerService('principalBackend', function (IAppContainer $c) {
@@ -62,6 +75,16 @@ class Application extends App {
});
$this->registerVersionBackends();
+
+ /**
+ * Register Events
+ */
+ $this->registerEvents($dispatcher);
+
+ /**
+ * Register hooks
+ */
+ Hooks::connectHooks();
}
public function registerVersionBackends() {
@@ -98,4 +121,10 @@ class Application extends App {
$logger->logException($e);
}
}
+
+ protected function registerEvents(IEventDispatcher $dispatcher) {
+ $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
+ $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
+ }
+
}