From 91e7f12088cb87ffef5660429ece404364167978 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 16 Jul 2020 17:08:03 +0200 Subject: Adjust apps' code to use the ContainerInterface Signed-off-by: Christoph Wurst --- .../federatedfilesharing/lib/AppInfo/Application.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'apps/federatedfilesharing/lib') diff --git a/apps/federatedfilesharing/lib/AppInfo/Application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php index 09f881d5bb8..1afaa01a48f 100644 --- a/apps/federatedfilesharing/lib/AppInfo/Application.php +++ b/apps/federatedfilesharing/lib/AppInfo/Application.php @@ -28,6 +28,7 @@ namespace OCA\FederatedFileSharing\AppInfo; +use Closure; use OCA\FederatedFileSharing\Listeners\LoadAdditionalScriptsListener; use OCA\FederatedFileSharing\Notifier; use OCA\FederatedFileSharing\OCM\CloudFederationProviderFiles; @@ -36,6 +37,9 @@ use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\Federation\ICloudFederationProviderManager; +use OCP\Notification\IManager as INotifiactionManager; +use Psr\Container\ContainerInterface; class Application extends App implements IBootstrap { public function __construct() { @@ -47,16 +51,20 @@ class Application extends App implements IBootstrap { } public function boot(IBootContext $context): void { - $server = $context->getServerContainer(); + $context->injectFn(Closure::fromCallable([$this, 'registerCloudFederationProvider'])); + $context->injectFn(Closure::fromCallable([$this, 'registerNotificationManager'])); + } - $cloudFederationManager = $server->getCloudFederationProviderManager(); - $cloudFederationManager->addCloudFederationProvider('file', + private function registerCloudFederationProvider(ICloudFederationProviderManager $manager, + ContainerInterface $container): void { + $manager->addCloudFederationProvider('file', 'Federated Files Sharing', - function () use ($server) { - return $server->query(CloudFederationProviderFiles::class); + function () use ($container) { + return $container->get(CloudFederationProviderFiles::class); }); + } - $manager = $server->getNotificationManager(); + private function registerNotificationManager(INotifiactionManager $manager): void { $manager->registerNotifierService(Notifier::class); } } -- cgit v1.2.3