瀏覽代碼

Use the settings icon for the update notification

Signed-off-by: Joas Schilling <coding@schilljs.com>
Joas Schilling 8 年之前
父節點
當前提交
917cac5436

+ 1 - 4
apps/updatenotification/appinfo/app.php

@@ -43,10 +43,7 @@ if(\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) {
 
 	$manager = \OC::$server->getNotificationManager();
 	$manager->registerNotifier(function() use ($manager) {
-		return new \OCA\UpdateNotification\Notification\Notifier(
-			$manager,
-			\OC::$server->getL10NFactory()
-		);
+		return \OC::$server->query(\OCA\UpdateNotification\Notification\Notifier::class);
 	}, function() {
 		$l = \OC::$server->getL10N('updatenotification');
 		return [

+ 1 - 0
apps/updatenotification/img/notification.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewbox="0 0 16 16"><path d="M6.938 0A.43.43 0 0 0 6.5.438v1.25a5.818 5.818 0 0 0-1.53.656l-.907-.906a.436.436 0 0 0-.625 0l-1.5 1.5a.436.436 0 0 0 0 .624l.906.907c-.285.48-.514.976-.656 1.53H.938a.43.43 0 0 0-.438.438v2.125C.5 8.81.69 9 .938 9h1.25a5.82 5.82 0 0 0 .656 1.53l-.907.908a.436.436 0 0 0 0 .625l1.5 1.5c.176.176.45.176.625 0l.907-.907c.48.285.976.514 1.53.656v1.25c0 .25.19.438.437.438h2.125a.43.43 0 0 0 .438-.438v-1.25a5.82 5.82 0 0 0 1.53-.657l.907.907c.176.175.45.175.625 0l1.5-1.5a.436.436 0 0 0 0-.625l-.906-.906A5.79 5.79 0 0 0 13.812 9h1.25a.43.43 0 0 0 .438-.438V6.437A.43.43 0 0 0 15.062 6h-1.25a5.79 5.79 0 0 0-.656-1.532l.906-.906a.436.436 0 0 0 0-.625l-1.5-1.5a.436.436 0 0 0-.625 0l-.906.906a5.816 5.816 0 0 0-1.53-.656V.437A.43.43 0 0 0 9.063 0zM8 4.157a3.344 3.344 0 0 1 0 6.686 3.344 3.344 0 0 1 0-6.686z" display="block"/></svg>

+ 9 - 1
apps/updatenotification/lib/Notification/Notifier.php

@@ -24,6 +24,7 @@
 namespace OCA\UpdateNotification\Notification;
 
 
+use OCP\IURLGenerator;
 use OCP\L10N\IFactory;
 use OCP\Notification\IManager;
 use OCP\Notification\INotification;
@@ -31,6 +32,9 @@ use OCP\Notification\INotifier;
 
 class Notifier implements INotifier {
 
+	/** @var IURLGenerator */
+	protected $url;
+
 	/** @var IManager */
 	protected $notificationManager;
 
@@ -43,10 +47,12 @@ class Notifier implements INotifier {
 	/**
 	 * Notifier constructor.
 	 *
+	 * @param IURLGenerator $url
 	 * @param IManager $notificationManager
 	 * @param IFactory $l10NFactory
 	 */
-	public function __construct(IManager $notificationManager, IFactory $l10NFactory) {
+	public function __construct(IURLGenerator $url, IManager $notificationManager, IFactory $l10NFactory) {
+		$this->url = $url;
 		$this->notificationManager = $notificationManager;
 		$this->l10NFactory = $l10NFactory;
 		$this->appVersions = $this->getAppVersions();
@@ -81,6 +87,8 @@ class Notifier implements INotifier {
 			$notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()]));
 		}
 
+		$notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('updatenotification', 'notification.svg')));
+
 		return $notification;
 	}