Add an icon to the federated sharing notification
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
a12d2e67e7
commit
b31d621840
|
@ -31,10 +31,7 @@ $app->registerSettings();
|
||||||
|
|
||||||
$manager = \OC::$server->getNotificationManager();
|
$manager = \OC::$server->getNotificationManager();
|
||||||
$manager->registerNotifier(function() {
|
$manager->registerNotifier(function() {
|
||||||
return new Notifier(
|
return \OC::$server->query(Notifier::class);
|
||||||
\OC::$server->getL10NFactory(),
|
|
||||||
\OC::$server->getContactsManager()
|
|
||||||
);
|
|
||||||
}, function() use ($l) {
|
}, function() use ($l) {
|
||||||
return [
|
return [
|
||||||
'id' => 'files_sharing',
|
'id' => 'files_sharing',
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace OCA\FederatedFileSharing;
|
||||||
use OC\HintException;
|
use OC\HintException;
|
||||||
use OC\Share\Helper;
|
use OC\Share\Helper;
|
||||||
use OCP\Contacts\IManager;
|
use OCP\Contacts\IManager;
|
||||||
|
use OCP\IURLGenerator;
|
||||||
use OCP\L10N\IFactory;
|
use OCP\L10N\IFactory;
|
||||||
use OCP\Notification\INotification;
|
use OCP\Notification\INotification;
|
||||||
use OCP\Notification\INotifier;
|
use OCP\Notification\INotifier;
|
||||||
|
@ -36,16 +37,20 @@ class Notifier implements INotifier {
|
||||||
protected $factory;
|
protected $factory;
|
||||||
/** @var IManager */
|
/** @var IManager */
|
||||||
protected $contactsManager;
|
protected $contactsManager;
|
||||||
|
/** @var IURLGenerator */
|
||||||
|
protected $url;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $federatedContacts;
|
protected $federatedContacts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param IFactory $factory
|
* @param IFactory $factory
|
||||||
* @param IManager $contactsManager
|
* @param IManager $contactsManager
|
||||||
|
* @param IURLGenerator $url
|
||||||
*/
|
*/
|
||||||
public function __construct(IFactory $factory, IManager $contactsManager) {
|
public function __construct(IFactory $factory, IManager $contactsManager, IURLGenerator $url) {
|
||||||
$this->factory = $factory;
|
$this->factory = $factory;
|
||||||
$this->contactsManager = $contactsManager;
|
$this->contactsManager = $contactsManager;
|
||||||
|
$this->url = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,6 +70,8 @@ class Notifier implements INotifier {
|
||||||
switch ($notification->getSubject()) {
|
switch ($notification->getSubject()) {
|
||||||
// Deal with known subjects
|
// Deal with known subjects
|
||||||
case 'remote_share':
|
case 'remote_share':
|
||||||
|
$notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
|
||||||
$params = $notification->getSubjectParameters();
|
$params = $notification->getSubjectParameters();
|
||||||
if ($params[0] !== $params[1] && $params[1] !== null) {
|
if ($params[0] !== $params[1] && $params[1] !== null) {
|
||||||
$notification->setParsedSubject(
|
$notification->setParsedSubject(
|
||||||
|
|
Loading…
Reference in New Issue