Files

39 lines
938 B
PHP

<?php
declare(strict_types=1);
namespace OCA\CustomPwa;
use OCA\CustomPwa\Service\PushNotificationService;
use OCP\Notification\IApp;
use OCP\Notification\INotification;
use Psr\Log\LoggerInterface;
class App implements IApp {
public function __construct(
private PushNotificationService $pushNotificationService,
private LoggerInterface $logger,
) {
}
public function notify(INotification $notification): void {
try {
$this->pushNotificationService->forwardNotification($notification);
} catch (\Throwable $e) {
$this->logger->warning('CustomPWA notification forwarder failed', [
'app' => 'custom_pwa',
'notificationApp' => $notification->getApp(),
'notificationSubject' => $notification->getSubject(),
'error' => $e->getMessage(),
]);
}
}
public function markProcessed(INotification $notification): void {
}
public function getCount(INotification $notification): int {
return 0;
}
}