Application.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Comments\AppInfo;
  7. use OCA\Comments\Capabilities;
  8. use OCA\Comments\Listener\CommentsEntityEventListener;
  9. use OCA\Comments\Listener\CommentsEventListener;
  10. use OCA\Comments\Listener\LoadAdditionalScripts;
  11. use OCA\Comments\Listener\LoadSidebarScripts;
  12. use OCA\Comments\MaxAutoCompleteResultsInitialState;
  13. use OCA\Comments\Notification\Notifier;
  14. use OCA\Comments\Search\CommentsSearchProvider;
  15. use OCA\Comments\Search\LegacyProvider;
  16. use OCA\Files\Event\LoadAdditionalScriptsEvent;
  17. use OCA\Files\Event\LoadSidebar;
  18. use OCP\AppFramework\App;
  19. use OCP\AppFramework\Bootstrap\IBootContext;
  20. use OCP\AppFramework\Bootstrap\IBootstrap;
  21. use OCP\AppFramework\Bootstrap\IRegistrationContext;
  22. use OCP\Comments\CommentsEntityEvent;
  23. use OCP\Comments\CommentsEvent;
  24. use OCP\ISearch;
  25. class Application extends App implements IBootstrap {
  26. public const APP_ID = 'comments';
  27. public function __construct(array $urlParams = []) {
  28. parent::__construct(self::APP_ID, $urlParams);
  29. }
  30. public function register(IRegistrationContext $context): void {
  31. $context->registerCapability(Capabilities::class);
  32. $context->registerEventListener(
  33. LoadAdditionalScriptsEvent::class,
  34. LoadAdditionalScripts::class
  35. );
  36. $context->registerEventListener(
  37. LoadSidebar::class,
  38. LoadSidebarScripts::class
  39. );
  40. $context->registerEventListener(
  41. CommentsEntityEvent::class,
  42. CommentsEntityEventListener::class
  43. );
  44. $context->registerEventListener(
  45. CommentsEvent::class,
  46. CommentsEventListener::class,
  47. );
  48. $context->registerSearchProvider(CommentsSearchProvider::class);
  49. $context->registerInitialStateProvider(MaxAutoCompleteResultsInitialState::class);
  50. $context->registerNotifierService(Notifier::class);
  51. }
  52. public function boot(IBootContext $context): void {
  53. $context->getServerContainer()->get(ISearch::class)->registerProvider(LegacyProvider::class, ['apps' => ['files']]);
  54. }
  55. }