Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ public function registerNavigationEntry() {

public function registerNotifications() {
$notificationManager = \OC::$server->getNotificationManager();
$self = &$this;
$notificationManager->registerNotifier(function() use (&$self) {
return $self->getContainer()->query(Notifier::class);
}, function() {
return ['id' => 'deck', 'name' => 'Deck'];
});
$notificationManager->registerNotifierService(Notifier::class);
}

/**
Expand Down
22 changes: 21 additions & 1 deletion lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,34 @@ public function __construct(
$this->boardMapper = $boardMapper;
}

/**
* Identifier of the notifier, only use [a-z0-9_]
*
* @return string
* @since 17.0.0
*/
public function getID(): string {
return 'deck';
}

/**
* Human readable name describing the notifier
*
* @return string
* @since 17.0.0
*/
public function getName(): string {
return $this->l10nFactory->get('deck')->t('Deck');
}

/**
* @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
* @since 9.0.0
*/
public function prepare(INotification $notification, $languageCode) {
public function prepare(INotification $notification, string $languageCode): INotification {
$l = $this->l10nFactory->get('deck', $languageCode);
if ($notification->getApp() !== 'deck') {
throw new \InvalidArgumentException();
Expand Down