summaryrefslogtreecommitdiff
blob: e228584d85cfca0ae538c2c51597e631fc78a23d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

namespace EchoPush;

use EchoServices;
use Job;

class NotificationRequestJob extends Job {

	/**
	 * @return bool success
	 */
	public function run(): bool {
		$centralId = $this->params['centralId'];
		$echoServices = EchoServices::getInstance();
		$subscriptionManager = $echoServices->getPushSubscriptionManager();
		$subscriptions = $subscriptionManager->getSubscriptionsForUser( $centralId );
		if ( count( $subscriptions ) === 0 ) {
			return true;
		}
		$serviceClient = $echoServices->getPushNotificationServiceClient();
		$serviceClient->sendCheckEchoRequests( $subscriptions );
		return true;
	}

}