Add f7push v0.1: FCM device registry and push API for F7cloud.
Portable occ-based config, OCS endpoints for APK registration, notification relay, and server-side push dispatch.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user