From 90fa27694a6f454820487dcb1ca4e4ceec90a9a1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Jun 2017 13:48:51 +0200 Subject: Use PNG version of the icons for shipped activities Signed-off-by: Joas Schilling --- apps/sharebymail/lib/Activity.php | 64 +++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 16 deletions(-) (limited to 'apps/sharebymail') diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index 73751cb241e..df9cb36e0d7 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -117,8 +117,12 @@ class Activity implements IProvider { ])) ->setRichSubject($this->l->t('Shared with {email}'), [ 'email' => $parsedParameters['email'], - ]) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + ]); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + } } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) { $event->setParsedSubject($this->l->t('Shared with %1$s by %2$s', [ $parsedParameters['email']['name'], @@ -127,20 +131,32 @@ class Activity implements IProvider { ->setRichSubject($this->l->t('Shared with {email} by {actor}'), [ 'email' => $parsedParameters['email'], 'actor' => $parsedParameters['actor'], - ]) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + ]); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + } } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) { $event->setParsedSubject($this->l->t('Password for mail share sent to %1$s', [ $parsedParameters['email']['name'] ])) ->setRichSubject($this->l->t('Password for mail share sent to {email}'), [ 'email' => $parsedParameters['email'] - ]) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + ]); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + } } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) { $event->setParsedSubject($this->l->t('Password for mail share sent to you')) - ->setRichSubject($this->l->t('Password for mail share sent to you')) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + ->setRichSubject($this->l->t('Password for mail share sent to you')); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + } } else { throw new \InvalidArgumentException(); } @@ -162,29 +178,45 @@ class Activity implements IProvider { $parsedParameters['file']['path'], $parsedParameters['email']['name'], ])) - ->setRichSubject($this->l->t('You shared {file} with {email} by mail'), $parsedParameters) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + ->setRichSubject($this->l->t('You shared {file} with {email} by mail'), $parsedParameters); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + } } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) { $event->setParsedSubject($this->l->t('%3$s shared %1$s with %2$s by mail', [ $parsedParameters['file']['path'], $parsedParameters['email']['name'], $parsedParameters['actor']['name'], ])) - ->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + ->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + } } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) { $event->setParsedSubject($this->l->t('Password to access %1$s was sent to %2s', [ $parsedParameters['file']['path'], $parsedParameters['email']['name'] ])) - ->setRichSubject($this->l->t('Password to access {file} was sent to {email}'), $parsedParameters) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + ->setRichSubject($this->l->t('Password to access {file} was sent to {email}'), $parsedParameters); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + } } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) { $event->setParsedSubject( $this->l->t('Password to access %1$s was sent to you', [$parsedParameters['file']['path']])) - ->setRichSubject($this->l->t('Password to access {file} was sent to you'), $parsedParameters) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + ->setRichSubject($this->l->t('Password to access {file} was sent to you'), $parsedParameters); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); + } } else { throw new \InvalidArgumentException(); -- cgit v1.2.3