Use PNG version of the icons for shipped activities

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-06-20 13:48:51 +02:00
parent 8b0546e3f9
commit 90fa27694a
No known key found for this signature in database
GPG key ID: E166FD8976B3BAC8
30 changed files with 272 additions and 70 deletions

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="32" width="32" viewBox="0 0 32 32"><path fill="#000" d="M16 3C7.163 3 0 7.925 0 14s7.163 11 16 11c.5 0 .98-.032 1.47-.063L26 32v-9.406c3.658-2.017 6-5.12 6-8.595 0-6.076-7.164-11-16-11z"/></svg>

After

Width:  |  Height:  |  Size: 243 B

View file

@ -87,7 +87,11 @@ class Provider implements IProvider {
if ($event->getSubject() === 'add_comment_subject') {
$this->parseMessage($event);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')));
}
if ($this->activityManager->isFormattingFilteredObject()) {
try {

View file

@ -84,7 +84,11 @@ class Calendar extends Base {
$this->l = $this->languageFactory->get('dav', $language);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')));
}
if ($event->getSubject() === self::SUBJECT_ADD) {
$subject = $this->l->t('{actor} created calendar {calendar}');

View file

@ -80,7 +80,11 @@ class Event extends Base {
$this->l = $this->languageFactory->get('dav', $language);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')));
}
if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') {
$subject = $this->l->t('{actor} created event {event} in calendar {calendar}');

View file

@ -40,7 +40,11 @@ class Todo extends Event {
$this->l = $this->languageFactory->get('dav', $language);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')));
}
if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') {
$subject = $this->l->t('{actor} created todo {todo} in list {calendar}');

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
apps/files/img/change.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -97,11 +97,19 @@ class FavoriteProvider implements IProvider {
public function parseShortVersion(IEvent $event) {
if ($event->getSubject() === self::SUBJECT_ADDED) {
$event->setParsedSubject($this->l->t('Added to favorites'))
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg')));
$event->setParsedSubject($this->l->t('Added to favorites'));
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg')));
}
} else if ($event->getSubject() === self::SUBJECT_REMOVED) {
$event->setParsedSubject($this->l->t('Removed from favorites'))
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.svg')));
$event->setParsedSubject($this->l->t('Removed from favorites'));
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.svg')));
}
} else {
throw new \InvalidArgumentException();
}
@ -120,10 +128,18 @@ class FavoriteProvider implements IProvider {
if ($event->getSubject() === self::SUBJECT_ADDED) {
$subject = $this->l->t('You added {file} to your favorites');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg')));
}
} else if ($event->getSubject() === self::SUBJECT_REMOVED) {
$subject = $this->l->t('You removed {file} from your favorites');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.svg')));
}
} else {
throw new \InvalidArgumentException();
}

View file

@ -110,21 +110,41 @@ class Provider implements IProvider {
if ($event->getSubject() === 'created_by') {
$subject = $this->l->t('Created by {user}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg')));
}
} else if ($event->getSubject() === 'changed_by') {
$subject = $this->l->t('Changed by {user}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else if ($event->getSubject() === 'deleted_by') {
$subject = $this->l->t('Deleted by {user}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg')));
}
} else if ($event->getSubject() === 'restored_by') {
$subject = $this->l->t('Restored by {user}');
} else if ($event->getSubject() === 'renamed_by') {
$subject = $this->l->t('Renamed by {user}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else if ($event->getSubject() === 'moved_by') {
$subject = $this->l->t('Moved by {user}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else {
throw new \InvalidArgumentException();
}
@ -151,41 +171,85 @@ class Provider implements IProvider {
if ($event->getSubject() === 'created_self') {
$subject = $this->l->t('You created {file}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg')));
}
} else if ($event->getSubject() === 'created_by') {
$subject = $this->l->t('{user} created {file}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg')));
}
} else if ($event->getSubject() === 'created_public') {
$subject = $this->l->t('{file} was created in a public folder');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg')));
}
} else if ($event->getSubject() === 'changed_self') {
$subject = $this->l->t('You changed {file}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else if ($event->getSubject() === 'changed_by') {
$subject = $this->l->t('{user} changed {file}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else if ($event->getSubject() === 'deleted_self') {
$subject = $this->l->t('You deleted {file}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg')));
}
} else if ($event->getSubject() === 'deleted_by') {
$subject = $this->l->t('{user} deleted {file}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg')));
}
} else if ($event->getSubject() === 'restored_self') {
$subject = $this->l->t('You restored {file}');
} else if ($event->getSubject() === 'restored_by') {
$subject = $this->l->t('{user} restored {file}');
} else if ($event->getSubject() === 'renamed_self') {
$subject = $this->l->t('You renamed {oldfile} to {newfile}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else if ($event->getSubject() === 'renamed_by') {
$subject = $this->l->t('{user} renamed {oldfile} to {newfile}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else if ($event->getSubject() === 'moved_self') {
$subject = $this->l->t('You moved {oldfile} to {newfile}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else if ($event->getSubject() === 'moved_by') {
$subject = $this->l->t('{user} moved {oldfile} to {newfile}');
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg')));
}
} else {
throw new \InvalidArgumentException();
}

View file

@ -51,7 +51,11 @@ class Downloads extends Base {
throw new \InvalidArgumentException();
}
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.svg')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;
@ -76,7 +80,11 @@ class Downloads extends Base {
throw new \InvalidArgumentException();
}
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.svg')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;

View file

@ -51,7 +51,11 @@ class Groups extends Base {
throw new \InvalidArgumentException();
}
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')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;
@ -78,7 +82,11 @@ class Groups extends Base {
throw new \InvalidArgumentException();
}
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')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;

View file

@ -58,7 +58,11 @@ class PublicLinks extends Base {
throw new \InvalidArgumentException();
}
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')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;
@ -90,7 +94,11 @@ class PublicLinks extends Base {
throw new \InvalidArgumentException();
}
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')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;

View file

@ -73,7 +73,11 @@ class RemoteShares extends Base {
throw new \InvalidArgumentException();
}
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')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;
@ -100,7 +104,11 @@ class RemoteShares extends Base {
throw new \InvalidArgumentException();
}
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')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;

View file

@ -60,7 +60,11 @@ class Users extends Base {
throw new \InvalidArgumentException();
}
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')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;
@ -92,7 +96,11 @@ class Users extends Base {
throw new \InvalidArgumentException();
}
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')));
}
$this->setSubjects($event, $subject, $parsedParameters);
return $event;

View file

@ -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();

View file

@ -104,7 +104,12 @@ class Provider implements IProvider {
*/
public function parseShortVersion(IEvent $event) {
$parsedParameters = $this->getParameters($event);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.svg')));
}
if ($event->getSubject() === self::ASSIGN_TAG) {
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
@ -157,7 +162,12 @@ class Provider implements IProvider {
*/
public function parseLongVersion(IEvent $event) {
$parsedParameters = $this->getParameters($event);
if ($this->activityManager->getRequirePNG()) {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.png')));
} else {
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.svg')));
}
if ($event->getSubject() === self::CREATE_TAG) {
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {

View file

@ -24,8 +24,8 @@ namespace OCA\TwoFactorBackupCodes\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,17 +37,17 @@ class Provider implements IProvider {
/** @var IURLGenerator */
private $urlGenerator;
/** @var ILogger */
private $logger;
/** @var IManager */
private $activityManager;
/**
* @param L10nFactory $l10n
* @param IURLGenerator $urlGenerator
* @param ILogger $logger
* @param IManager $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->activityManager = $activityManager;
$this->l10n = $l10n;
}
@ -61,7 +61,12 @@ class Provider implements IProvider {
switch ($event->getSubject()) {
case 'codes_generated':
$event->setParsedSubject($l->t('You created two-factor backup codes for your account'));
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();

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
core/img/actions/share.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
core/img/actions/star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
core/img/actions/tag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -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);
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');

View file

@ -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'],
]));
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'],
]));
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();

BIN
settings/img/personal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB