Skip to content
Snippets Groups Projects
Unverified Commit 44bc697a authored by Joas Schilling's avatar Joas Schilling
Browse files

Update Federated sharing notifier

parent a386ecec
No related branches found
No related tags found
No related merge requests found
...@@ -29,15 +29,7 @@ $app = new \OCA\FederatedFileSharing\AppInfo\Application(); ...@@ -29,15 +29,7 @@ $app = new \OCA\FederatedFileSharing\AppInfo\Application();
$eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher = \OC::$server->getEventDispatcher();
$manager = \OC::$server->getNotificationManager(); $manager = \OC::$server->getNotificationManager();
$manager->registerNotifier(function() { $manager->registerNotifier(Notifier::class);
return \OC::$server->query(Notifier::class);
}, function() {
$l = \OC::$server->getL10N('files_sharing');
return [
'id' => 'files_sharing',
'name' => $l->t('Federated sharing'),
];
});
$federatedShareProvider = $app->getFederatedShareProvider(); $federatedShareProvider = $app->getFederatedShareProvider();
......
...@@ -59,13 +59,33 @@ class Notifier implements INotifier { ...@@ -59,13 +59,33 @@ class Notifier implements INotifier {
$this->cloudIdManager = $cloudIdManager; $this->cloudIdManager = $cloudIdManager;
} }
/**
* Identifier of the notifier, only use [a-z0-9_]
*
* @return string
* @since 17.0.0
*/
public function getID(): string {
return 'federatedfilesharing';
}
/**
* Human readable name describing the notifier
*
* @return string
* @since 17.0.0
*/
public function getName(): string {
return $this->factory->get('federatedfilesharing')->t('Federated sharing');
}
/** /**
* @param INotification $notification * @param INotification $notification
* @param string $languageCode The code of the language that should be used to prepare the notification * @param string $languageCode The code of the language that should be used to prepare the notification
* @return INotification * @return INotification
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function prepare(INotification $notification, $languageCode) { public function prepare(INotification $notification, string $languageCode): INotification {
if ($notification->getApp() !== 'files_sharing') { if ($notification->getApp() !== 'files_sharing') {
// Not my app => throw // Not my app => throw
throw new \InvalidArgumentException(); throw new \InvalidArgumentException();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment