summaryrefslogtreecommitdiffstats
path: root/settings/Activity
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-06-20 13:48:51 +0200
committerJoas Schilling <coding@schilljs.com>2017-06-20 13:48:51 +0200
commit90fa27694a6f454820487dcb1ca4e4ceec90a9a1 (patch)
treeec6821e7aff73031293a9ef3f6a56a3baa672630 /settings/Activity
parent8b0546e3f9741980ee2c63b3aca04392408b2e02 (diff)
downloadnextcloud-server-90fa27694a6f454820487dcb1ca4e4ceec90a9a1.tar.gz
nextcloud-server-90fa27694a6f454820487dcb1ca4e4ceec90a9a1.zip
Use PNG version of the icons for shipped activities
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'settings/Activity')
-rw-r--r--settings/Activity/Provider.php14
-rw-r--r--settings/Activity/SecurityProvider.php22
2 files changed, 27 insertions, 9 deletions
diff --git a/settings/Activity/Provider.php b/settings/Activity/Provider.php
index 7893b450a44..575b7e9b569 100644
--- a/settings/Activity/Provider.php
+++ b/settings/Activity/Provider.php
@@ -22,6 +22,7 @@
namespace OC\Settings\Activity;
use OCP\Activity\IEvent;
+use OCP\Activity\IManager;
use OCP\Activity\IProvider;
use OCP\IL10N;
use OCP\IURLGenerator;
@@ -50,6 +51,9 @@ class Provider implements IProvider {
/** @var IUserManager */
protected $userManager;
+ /** @var IManager */
+ private $activityManager;
+
/** @var string[] cached displayNames - key is the UID and value the displayname */
protected $displayNames = [];
@@ -57,11 +61,13 @@ class Provider implements IProvider {
* @param IFactory $languageFactory
* @param IURLGenerator $url
* @param IUserManager $userManager
+ * @param IManager $activityManager
*/
- public function __construct(IFactory $languageFactory, IURLGenerator $url, IUserManager $userManager) {
+ public function __construct(IFactory $languageFactory, IURLGenerator $url, IUserManager $userManager, IManager $activityManager) {
$this->languageFactory = $languageFactory;
$this->url = $url;
$this->userManager = $userManager;
+ $this->activityManager = $activityManager;
}
/**
@@ -79,7 +85,11 @@ class Provider implements IProvider {
$this->l = $this->languageFactory->get('settings', $language);
- $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('settings', 'personal.svg')));
+ if ($this->activityManager->getRequirePNG()) {
+ $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('settings', 'personal.png')));
+ } else {
+ $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('settings', 'personal.svg')));
+ }
if ($event->getSubject() === self::PASSWORD_CHANGED_BY) {
$subject = $this->l->t('{actor} changed your password');
diff --git a/settings/Activity/SecurityProvider.php b/settings/Activity/SecurityProvider.php
index 74747f684da..7b27fde363f 100644
--- a/settings/Activity/SecurityProvider.php
+++ b/settings/Activity/SecurityProvider.php
@@ -24,8 +24,8 @@ namespace OC\Settings\Activity;
use InvalidArgumentException;
use OCP\Activity\IEvent;
+use OCP\Activity\IManager;
use OCP\Activity\IProvider;
-use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\L10N\IFactory as L10nFactory;
@@ -37,13 +37,13 @@ class SecurityProvider implements IProvider {
/** @var IURLGenerator */
private $urlGenerator;
- /** @var ILogger */
- private $logger;
+ /** @var IManager */
+ private $activityManager;
- public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, ILogger $logger) {
- $this->logger = $logger;
+ public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) {
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
+ $this->activityManager = $activityManager;
}
public function parse($language, IEvent $event, IEvent $previousEvent = null) {
@@ -59,14 +59,22 @@ class SecurityProvider implements IProvider {
$event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [
$params['provider'],
]));
- $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
+ if ($this->activityManager->getRequirePNG()) {
+ $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
+ } else {
+ $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
+ }
break;
case 'twofactor_failed':
$params = $event->getSubjectParameters();
$event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [
$params['provider'],
]));
- $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
+ if ($this->activityManager->getRequirePNG()) {
+ $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
+ } else {
+ $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
+ }
break;
default:
throw new InvalidArgumentException();