2016-04-18 19:17:08 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 17:49:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2016-05-26 20:56:05 +03:00
|
|
|
* @author Björn Schießle <bjoern@schiessle.org>
|
2020-04-29 12:57:22 +03:00
|
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
2019-12-19 15:16:31 +03:00
|
|
|
* @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
|
|
|
|
* @author Maxence Lange <maxence@artificial-owl.com>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2016-04-18 19:17:08 +03:00
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2016-04-18 19:17:08 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCA\FederatedFileSharing\AppInfo;
|
|
|
|
|
2020-07-16 18:08:03 +03:00
|
|
|
use Closure;
|
2020-07-13 17:23:59 +03:00
|
|
|
use OCA\FederatedFileSharing\Listeners\LoadAdditionalScriptsListener;
|
2019-12-05 16:15:32 +03:00
|
|
|
use OCA\FederatedFileSharing\Notifier;
|
2018-04-30 12:49:24 +03:00
|
|
|
use OCA\FederatedFileSharing\OCM\CloudFederationProviderFiles;
|
2020-07-13 17:23:59 +03:00
|
|
|
use OCA\Files\Event\LoadAdditionalScriptsEvent;
|
2016-04-18 19:17:08 +03:00
|
|
|
use OCP\AppFramework\App;
|
2020-07-13 17:23:59 +03:00
|
|
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
|
|
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
|
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
2020-07-16 18:08:03 +03:00
|
|
|
use OCP\Federation\ICloudFederationProviderManager;
|
|
|
|
use OCP\Notification\IManager as INotifiactionManager;
|
|
|
|
use Psr\Container\ContainerInterface;
|
2016-04-18 19:17:08 +03:00
|
|
|
|
2020-07-13 17:23:59 +03:00
|
|
|
class Application extends App implements IBootstrap {
|
2016-05-23 12:48:14 +03:00
|
|
|
public function __construct() {
|
|
|
|
parent::__construct('federatedfilesharing');
|
2020-07-13 17:23:59 +03:00
|
|
|
}
|
2016-08-19 13:01:13 +03:00
|
|
|
|
2020-07-13 17:23:59 +03:00
|
|
|
public function register(IRegistrationContext $context): void {
|
|
|
|
$context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function boot(IBootContext $context): void {
|
2020-07-16 18:08:03 +03:00
|
|
|
$context->injectFn(Closure::fromCallable([$this, 'registerCloudFederationProvider']));
|
|
|
|
$context->injectFn(Closure::fromCallable([$this, 'registerNotificationManager']));
|
|
|
|
}
|
2016-08-19 13:01:13 +03:00
|
|
|
|
2020-07-16 18:08:03 +03:00
|
|
|
private function registerCloudFederationProvider(ICloudFederationProviderManager $manager,
|
|
|
|
ContainerInterface $container): void {
|
|
|
|
$manager->addCloudFederationProvider('file',
|
2018-04-18 17:05:11 +03:00
|
|
|
'Federated Files Sharing',
|
2020-07-16 18:08:03 +03:00
|
|
|
function () use ($container) {
|
|
|
|
return $container->get(CloudFederationProviderFiles::class);
|
2018-04-18 17:05:11 +03:00
|
|
|
});
|
2020-07-16 18:08:03 +03:00
|
|
|
}
|
2018-04-18 17:05:11 +03:00
|
|
|
|
2020-07-16 18:08:03 +03:00
|
|
|
private function registerNotificationManager(INotifiactionManager $manager): void {
|
2019-12-05 16:15:32 +03:00
|
|
|
$manager->registerNotifierService(Notifier::class);
|
2016-04-18 19:17:08 +03:00
|
|
|
}
|
|
|
|
}
|