From 40bf5cfdb6eafd7729a0444dcbf94856f9c45813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20N=C3=BCsse?= Date: Wed, 13 Nov 2019 23:05:12 +0100 Subject: [PATCH] reintroduced fixes for nc17 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Felix NĂ¼sse --- appinfo/app.php | 12 +----------- lib/Notifier.php | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index cee29ffe..2dba5e99 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -26,17 +26,7 @@ $app->registerPersonalPage(); $l = \OC::$server->getL10N('passman'); $manager = \OC::$server->getNotificationManager(); -$manager->registerNotifier(function() { - return new Notifier( - \OC::$server->getL10NFactory() - ); -}, function() use ($l) { - return [ - 'id' => 'passman', - 'name' => $l->t('Passwords'), - ]; -}); - +$manager->registerNotifierService(Notifier::class); /** * Loading translations * diff --git a/lib/Notifier.php b/lib/Notifier.php index fcf7e45a..c1a1c000 100644 --- a/lib/Notifier.php +++ b/lib/Notifier.php @@ -37,7 +37,7 @@ class Notifier implements INotifier { * @param INotification $notification * @param string $languageCode The code of the language that should be used to prepare the notification */ - public function prepare(INotification $notification, $languageCode) { +public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'passman') { // Not my app => throw throw new \InvalidArgumentException(); @@ -109,4 +109,21 @@ class Notifier implements INotifier { throw new \InvalidArgumentException(); } } -} \ No newline at end of file + + /** + * Identifier of the notifier + * + * @return string + */ + public function getID(): string { + return 'passman'; + } + /** + * Human readable name describing the notifier + * + * @return string + */ + public function getName(): string { + return $this->factory->get('passman')->t('Passwords'); + } +}