l10n = $l10n; $this->factory = $factory; $this->contactsManager = $contactsManager; $this->url = $url; $this->cloudIdManager = $cloudIdManager; } /** * Identifier of the notifier, only use [a-z0-9_] * * @return string * @since 17.0.0 */ public function getID(): string { return Application::APP_ID; } /** * Human readable name describing the notifier * * @return string * @since 17.0.0 */ public function getName(): string { return $this->l10n->t('Social'); } /** * @param INotification $notification * @param string $languageCode The code of the language that should be used to prepare the notification * * @return INotification * @throws InvalidArgumentException */ public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== Application::APP_ID) { throw new InvalidArgumentException(); } $l10n = $this->factory->get(Application::APP_ID, $languageCode); $notification->setIcon( $this->url->getAbsoluteURL($this->url->imagePath('social', 'social_dark.svg')) ); $params = $notification->getSubjectParameters(); switch ($notification->getSubject()) { case 'update_alpha3': $notification->setParsedSubject('The Social App has been updated to alpha3.'); $notification->setParsedMessage( $l10n->t( 'Please note that the data from alpha2 can only be migrated manually. A detailed documentation to guide you during this process is available using the button below.' ) ); break; default: throw new InvalidArgumentException(); } foreach ($notification->getActions() as $action) { switch ($action->getLabel()) { case 'help': $action->setParsedLabel($l10n->t('Help')) ->setPrimary(true); break; } $notification->addParsedAction($action); } return $notification; } }