From 1aefbed55fab34c4d20b332b6d2ee3d703c6aada Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 1 Dec 2016 15:33:13 +0100 Subject: [PATCH] Highlight the app name in the notification Signed-off-by: Joas Schilling --- .../lib/Notification/Notifier.php | 9 ++++++++- lib/public/RichObjectStrings/Definitions.php | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/apps/updatenotification/lib/Notification/Notifier.php b/apps/updatenotification/lib/Notification/Notifier.php index ccc2c2b6e2..00cc94095c 100644 --- a/apps/updatenotification/lib/Notification/Notifier.php +++ b/apps/updatenotification/lib/Notification/Notifier.php @@ -84,7 +84,14 @@ class Notifier implements INotifier { $this->updateAlreadyInstalledCheck($notification, $this->appVersions[$notification->getObjectType()]); } - $notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()])); + $notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()])) + ->setRichSubject($l->t('Update for {app} to version %s is available.', $notification->getObjectId()), [ + 'app' => [ + 'type' => 'app', + 'id' => $notification->getObjectType(), + 'name' => $appName, + ] + ]); } $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('updatenotification', 'notification.svg'))); diff --git a/lib/public/RichObjectStrings/Definitions.php b/lib/public/RichObjectStrings/Definitions.php index 2b35f9ceed..5f813f089f 100644 --- a/lib/public/RichObjectStrings/Definitions.php +++ b/lib/public/RichObjectStrings/Definitions.php @@ -96,6 +96,24 @@ class Definitions { ], ], ], + 'app' => [ + 'author' => 'Nextcloud', + 'app' => 'updatenotification', + 'since' => '11.0.0', + 'parameters' => [ + 'id' => [ + 'since' => '11.0.0', + 'required' => true, 'description' => 'The app id', + 'example' => 'updatenotification', + ], + 'name' => [ + 'since' => '11.0.0', + 'required' => true, + 'description' => 'The name of the app which should be used in the visual representation', + 'example' => 'Update notification', + ], + ], + ], 'calendar' => [ 'author' => 'Nextcloud', 'app' => 'dav',