From 808e5890355a9f719bd6db5f74c3514a07140963 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 14 Apr 2021 08:45:07 +0200 Subject: Allow registering NotifierServices trough IBootstrap Signed-off-by: Roeland Jago Douma --- .../AppFramework/Bootstrap/RegistrationContext.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib/private/AppFramework/Bootstrap') diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php index 4850de94ed4..662296b8dd6 100644 --- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php +++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php @@ -44,6 +44,7 @@ use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Template\ICustomTemplateProvider; use OCP\Http\WellKnown\IHandler; use OCP\ILogger; +use OCP\Notification\INotifier; use OCP\Search\IProvider; use OCP\Support\CrashReport\IReporter; use Throwable; @@ -90,6 +91,9 @@ class RegistrationContext { /** @var ServiceRegistration[] */ private $templateProviders = []; + /** @var ServiceRegistration[] */ + private $notifierServices; + /** @var ILogger */ private $logger; @@ -206,6 +210,13 @@ class RegistrationContext { $providerClass ); } + + public function registerNotifierService(string $notifierClass): void { + $this->context->registerNotifierService( + $this->appId, + $notifierClass + ); + } }; } @@ -273,6 +284,10 @@ class RegistrationContext { $this->templateProviders[] = new ServiceRegistration($appId, $class); } + public function registerNotifierService(string $appId, string $class): void { + $this->notifierServices[] = new ServiceRegistration($appId, $class); + } + /** * @param App[] $apps */ @@ -457,4 +472,11 @@ class RegistrationContext { public function getTemplateProviders(): array { return $this->templateProviders; } + + /** + * @return ServiceRegistration[] + */ + public function getNotifierServices(): array { + return $this->notifierServices; + } } -- cgit v1.2.3