Skip to content

Commit

Permalink
cr comments fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mdspeardevs committed Nov 20, 2024
1 parent 9d55978 commit ec47d72
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions src/WebPushSender/WebPushSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\User\Model\UserInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Translation\TranslatableMessage;
use Traversable;

final class WebPushSender implements WebPushSenderInterface
Expand All @@ -36,19 +34,17 @@ final class WebPushSender implements WebPushSenderInterface
public const GROUP_RECEIVER = 'group';

public function __construct(
private UserSubscriptionRepositoryInterface $userSubscriptionRepository,
private UserSubscriptionManagerInterface $userSubscriptionManager,
private PushMessageSender $sender,
private UserSubscriptionRepositoryInterface $userSubscriptionRepository,
private UserSubscriptionManagerInterface $userSubscriptionManager,
private PushMessageSender $sender,
private PushNotificationTemplateRepositoryInterface $pushNotificationTemplateRepository,
private PushNotificationConfigurationService $pushNotificationConfigurationService,
private WebPushHistoryCreatorInterface $webPushHistoryCreator,
private ChannelContextInterface $channelContext,
private WebPushFactoryInterface $webPushFactory,
private ParameterMapperInterface $orderParameterMapper,
private LoggerInterface $logger,
private SessionInterface $session,
)
{
private PushNotificationConfigurationService $pushNotificationConfigurationService,
private WebPushHistoryCreatorInterface $webPushHistoryCreator,
private ChannelContextInterface $channelContext,
private WebPushFactoryInterface $webPushFactory,
private ParameterMapperInterface $orderParameterMapper,
private LoggerInterface $logger,
) {
}

public function sendWebPush(SendPushNotificationFormModel $sendPushNotificationFormModel): void
Expand Down Expand Up @@ -106,14 +102,9 @@ public function sendOrderWebPush(OrderInterface $order, string $pushNotification
$user->getEmail(),
);
} catch (\Exception $e) {
$this->session->getFlashBag()->add(
'error',
new TranslatableMessage('speardevs_sylius_push_notifications_plugin.ui.sent_error')
);
$this->logger->error('Problem while sending push notifications ' . $e->getMessage());
}
}

}

private function send(WebPushInterface $webPush, iterable $subscriptions): void
Expand Down

0 comments on commit ec47d72

Please sign in to comment.