df4e2dddec
Portable occ-based config, OCS endpoints for APK registration, notification relay, and server-side push dispatch.
37 lines
891 B
PHP
37 lines
891 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\F7Push\App;
|
|
|
|
use OCA\F7Push\Service\ConfigService;
|
|
use OCA\F7Push\Service\PushDispatcher;
|
|
use OCP\Notification\IApp;
|
|
use OCP\Notification\INotification;
|
|
|
|
/**
|
|
* Relays F7cloud account notifications to registered mobile devices via Firebase.
|
|
* Does not store notifications (handled by the notifications app).
|
|
*/
|
|
class NotificationRelay implements IApp {
|
|
public function __construct(
|
|
private PushDispatcher $pushDispatcher,
|
|
private ConfigService $config,
|
|
) {
|
|
}
|
|
|
|
public function notify(INotification $notification): void {
|
|
if (!$this->config->isEnabled() || !$this->config->listenNotifications()) {
|
|
return;
|
|
}
|
|
$this->pushDispatcher->dispatchFromNotification($notification);
|
|
}
|
|
|
|
public function markProcessed(INotification $notification): void {
|
|
}
|
|
|
|
public function getCount(INotification $notification): int {
|
|
return 0;
|
|
}
|
|
}
|