2016-04-18 12:17:08 -04:00
|
|
|
<?php
|
2024-05-28 10:42:42 -04:00
|
|
|
|
2016-04-18 12:17:08 -04:00
|
|
|
/**
|
2025-10-28 10:28:25 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2025 Nextcloud GmbH and Nextcloud contributors
|
2024-05-28 10:42:42 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2016-04-18 12:17:08 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\FederatedFileSharing\AppInfo;
|
|
|
|
|
|
2020-07-16 11:08:03 -04:00
|
|
|
use Closure;
|
2020-07-13 10:23:59 -04:00
|
|
|
use OCA\FederatedFileSharing\Listeners\LoadAdditionalScriptsListener;
|
2019-12-05 08:15:32 -05:00
|
|
|
use OCA\FederatedFileSharing\Notifier;
|
2018-04-30 05:49:24 -04:00
|
|
|
use OCA\FederatedFileSharing\OCM\CloudFederationProviderFiles;
|
2020-07-13 10:23:59 -04:00
|
|
|
use OCA\Files\Event\LoadAdditionalScriptsEvent;
|
2016-04-18 12:17:08 -04:00
|
|
|
use OCP\AppFramework\App;
|
2020-07-13 10:23:59 -04:00
|
|
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
|
|
|
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
|
|
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
2020-07-16 11:08:03 -04:00
|
|
|
use OCP\Federation\ICloudFederationProviderManager;
|
2016-04-18 12:17:08 -04:00
|
|
|
|
2020-07-13 10:23:59 -04:00
|
|
|
class Application extends App implements IBootstrap {
|
2025-12-09 21:50:50 -05:00
|
|
|
|
|
|
|
|
public const APP_ID = 'federatedfilesharing';
|
|
|
|
|
|
2016-05-23 05:48:14 -04:00
|
|
|
public function __construct() {
|
2025-12-09 21:50:50 -05:00
|
|
|
parent::__construct(self::APP_ID);
|
2020-07-13 10:23:59 -04:00
|
|
|
}
|
2016-08-19 06:01:13 -04:00
|
|
|
|
2020-07-13 10:23:59 -04:00
|
|
|
public function register(IRegistrationContext $context): void {
|
|
|
|
|
$context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
|
2021-04-16 06:39:08 -04:00
|
|
|
$context->registerNotifierService(Notifier::class);
|
2020-07-13 10:23:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function boot(IBootContext $context): void {
|
2020-07-16 11:08:03 -04:00
|
|
|
$context->injectFn(Closure::fromCallable([$this, 'registerCloudFederationProvider']));
|
|
|
|
|
}
|
2016-08-19 06:01:13 -04:00
|
|
|
|
2025-12-09 21:50:50 -05:00
|
|
|
private function registerCloudFederationProvider(ICloudFederationProviderManager $manager): void {
|
2025-10-28 10:28:25 -04:00
|
|
|
$fileResourceTypes = ['file', 'folder'];
|
|
|
|
|
foreach ($fileResourceTypes as $type) {
|
|
|
|
|
$manager->addCloudFederationProvider($type,
|
|
|
|
|
'Federated Files Sharing',
|
2025-12-09 21:50:50 -05:00
|
|
|
function (): CloudFederationProviderFiles {
|
|
|
|
|
return \OCP\Server::get(CloudFederationProviderFiles::class);
|
2025-10-28 10:28:25 -04:00
|
|
|
});
|
|
|
|
|
}
|
2020-07-16 11:08:03 -04:00
|
|
|
}
|
2016-04-18 12:17:08 -04:00
|
|
|
}
|