1
0

Application.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bjoern Schiessle <bjoern@schiessle.org>
  6. * @author Björn Schießle <bjoern@schiessle.org>
  7. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  8. * @author John Molakvoæ <skjnldsv@protonmail.com>
  9. * @author Morris Jobke <hey@morrisjobke.de>
  10. * @author Roeland Jago Douma <roeland@famdouma.nl>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OCA\FederatedFileSharing\AppInfo;
  28. use Closure;
  29. use OCA\FederatedFileSharing\Listeners\LoadAdditionalScriptsListener;
  30. use OCA\FederatedFileSharing\Notifier;
  31. use OCA\FederatedFileSharing\OCM\CloudFederationProviderFiles;
  32. use OCA\Files\Event\LoadAdditionalScriptsEvent;
  33. use OCP\AppFramework\App;
  34. use OCP\AppFramework\Bootstrap\IBootContext;
  35. use OCP\AppFramework\Bootstrap\IBootstrap;
  36. use OCP\AppFramework\Bootstrap\IRegistrationContext;
  37. use OCP\AppFramework\IAppContainer;
  38. use OCP\Federation\ICloudFederationProviderManager;
  39. class Application extends App implements IBootstrap {
  40. public function __construct() {
  41. parent::__construct('federatedfilesharing');
  42. }
  43. public function register(IRegistrationContext $context): void {
  44. $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
  45. $context->registerNotifierService(Notifier::class);
  46. }
  47. public function boot(IBootContext $context): void {
  48. $context->injectFn(Closure::fromCallable([$this, 'registerCloudFederationProvider']));
  49. }
  50. private function registerCloudFederationProvider(ICloudFederationProviderManager $manager,
  51. IAppContainer $appContainer): void {
  52. $manager->addCloudFederationProvider('file',
  53. 'Federated Files Sharing',
  54. function () use ($appContainer): CloudFederationProviderFiles {
  55. return $appContainer->get(CloudFederationProviderFiles::class);
  56. });
  57. }
  58. }