diff --git a/appinfo/info.xml b/appinfo/info.xml index 79b5d5b..ae76966 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -1,6 +1,5 @@ - + preferred_providers Preferred Providers Allow nextcloud to request user accounts @@ -12,14 +11,14 @@ files https://github.com/nextcloud/preferred_providers - + OCA\Preferred_Providers\Settings\Admin - OCA\Preferred_Providers\Settings\Section + OCA\Preferred_Providers\Settings\Section - OCA\Preferred_Providers\BackgroundJob\NotifyUnsetPassword - OCA\Preferred_Providers\BackgroundJob\ExpireUnverifiedAccounts + OCA\Preferred_Providers\BackgroundJob\NotifyUnsetPassword + OCA\Preferred_Providers\BackgroundJob\ExpireUnverifiedAccounts diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 97cf362..e5d89d0 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -2,7 +2,7 @@ declare(strict_types=1); /** * @copyright Copyright (c) 2018 John Molakvoæ - * + * * @author John Molakvoæ * * @license GNU AGPL version 3 or any later version @@ -33,7 +33,7 @@ class Application extends App { /** @var string */ protected $appName = 'preferred_providers'; - + public function __construct() { parent::__construct($this->appName); } @@ -45,14 +45,6 @@ public function register() { protected function registerNotifier(IServerContainer $server) { $manager = $server->getNotificationManager(); - $manager->registerNotifier(function() use ($server) { - return $server->query(Notifier::class); - }, function() use ($server) { - $l = $server->getL10N($this->appName); - return [ - 'id' => $this->appName, - 'name' => $l->t('Simple signup'), - ]; - }); + $manager->registerNotifierService(Notifier::class); } } diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 1099135..39e6927 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -54,13 +54,33 @@ public function __construct(string $appName, $this->urlGenerator = $urlGenerator; } + /** + * Identifier of the notifier, only use [a-z0-9_] + * + * @return string + * @since 17.0.0 + */ + public function getID(): string { + return $this->appName; + } + + /** + * Human readable name describing the notifier + * + * @return string + * @since 17.0.0 + */ + public function getName(): string { + return $this->l10nFactory->get($this->appName)->t('Simple signup'); + } + /** * @param INotification $notification * @param string $languageCode The code of the language that should be used to prepare the notification * @return INotification * @throws \InvalidArgumentException When the notification was not prepared by a notifier */ - public function prepare(INotification $notification, $languageCode): INotification { + public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== $this->appName) { throw new \InvalidArgumentException('Incorrect app'); }