l10nFactory->get('f7support')->t('Support'); } public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'f7support') { throw new UnknownNotificationException(); } if ($notification->getSubject() !== 'support_reply') { throw new UnknownNotificationException(); } $params = $notification->getSubjectParameters(); $ticketNumber = (string)($params['ticketNumber'] ?? ''); $ticketSubject = trim((string)($params['ticketSubject'] ?? '')); $preview = trim((string)($params['preview'] ?? '')); if ($preview === '') { $msgParams = $notification->getMessageParameters(); $preview = trim((string)($msgParams['preview'] ?? '')); } if ($ticketSubject !== '') { $title = 'Заявка ' . $ticketNumber . ': ' . $ticketSubject; } else { $title = 'Заявка ' . $ticketNumber; } if ($preview === '') { $preview = 'Новый ответ от поддержки'; } $icon = $this->urlGenerator->getAbsoluteURL( $this->urlGenerator->imagePath('f7support', 'app.svg') ); if ($this->notificationManager->isPreparingPushNotification()) { $notification->setParsedSubject($title . "\n" . $preview); } else { $notification->setParsedSubject($title); $notification->setParsedMessage($preview); } $notification->setIcon($icon); return $notification; } }