1
0

Application.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\FederatedFileSharing\AppInfo;
  8. use Closure;
  9. use OCA\FederatedFileSharing\Listeners\LoadAdditionalScriptsListener;
  10. use OCA\FederatedFileSharing\Notifier;
  11. use OCA\FederatedFileSharing\OCM\CloudFederationProviderFiles;
  12. use OCA\Files\Event\LoadAdditionalScriptsEvent;
  13. use OCP\AppFramework\App;
  14. use OCP\AppFramework\Bootstrap\IBootContext;
  15. use OCP\AppFramework\Bootstrap\IBootstrap;
  16. use OCP\AppFramework\Bootstrap\IRegistrationContext;
  17. use OCP\AppFramework\IAppContainer;
  18. use OCP\Federation\ICloudFederationProviderManager;
  19. class Application extends App implements IBootstrap {
  20. public function __construct() {
  21. parent::__construct('federatedfilesharing');
  22. }
  23. public function register(IRegistrationContext $context): void {
  24. $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
  25. $context->registerNotifierService(Notifier::class);
  26. }
  27. public function boot(IBootContext $context): void {
  28. $context->injectFn(Closure::fromCallable([$this, 'registerCloudFederationProvider']));
  29. }
  30. private function registerCloudFederationProvider(ICloudFederationProviderManager $manager,
  31. IAppContainer $appContainer): void {
  32. $manager->addCloudFederationProvider('file',
  33. 'Federated Files Sharing',
  34. function () use ($appContainer): CloudFederationProviderFiles {
  35. return $appContainer->get(CloudFederationProviderFiles::class);
  36. });
  37. }
  38. }