summaryrefslogtreecommitdiffstats
path: root/lib/Service/PushService.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Service/PushService.php')
-rw-r--r--lib/Service/PushService.php142
1 files changed, 71 insertions, 71 deletions
diff --git a/lib/Service/PushService.php b/lib/Service/PushService.php
index 913fc6c4..4986ab15 100644
--- a/lib/Service/PushService.php
+++ b/lib/Service/PushService.php
@@ -33,14 +33,14 @@ namespace OCA\Social\Service;
use daita\MySmallPhpTools\Traits\TAsync;
use OC;
-use OC\Push\Model\Helper\PushCallback;
+//use OC\Push\Model\Helper\PushCallback;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Exceptions\StreamNotFoundException;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCP\AppFramework\QueryException;
-use OCP\Push\Exceptions\PushInstallException;
-use OCP\Push\IPushManager;
-use OCP\Push\Model\IPushWrapper;
+//use OCP\Push\Exceptions\PushInstallException;
+//use OCP\Push\IPushManager;
+//use OCP\Push\Model\IPushWrapper;
/**
@@ -53,9 +53,9 @@ class PushService {
use TAsync;
-
- /** @var IPushManager */
- private $pushManager;
+//
+// /** @var IPushManager */
+// private $pushManager;
/** @var DetailsService */
private $detailsService;
@@ -82,13 +82,13 @@ class PushService {
$this->miscService = $miscService;
// FIX ME: nc18/push
- if ($this->miscService->getNcVersion() >= 19) {
- try {
- $this->pushManager = OC::$server->query(IPushManager::class);
- } catch (QueryException $e) {
- $miscService->log('QueryException while loading IPushManager - ' . $e->getMessage());
- }
- }
+// if ($this->miscService->getNcVersion() >= 19) {
+// try {
+// $this->pushManager = OC::$server->query(IPushManager::class);
+// } catch (QueryException $e) {
+// $miscService->log('QueryException while loading IPushManager - ' . $e->getMessage());
+// }
+// }
}
@@ -96,65 +96,65 @@ class PushService {
* @param string $streamId
*/
public function onNewStream(string $streamId) {
- // FIXME: remove in nc18
- if ($this->miscService->getNcVersion() < 19) {
- return;
- }
-
- if (!$this->pushManager->isAvailable()) {
- return;
- }
-
- try {
- $stream = $this->streamService->getStreamById($streamId);
- } catch (StreamNotFoundException $e) {
- return;
- }
-
- try {
- $pushHelper = $this->pushManager->getPushHelper();
- $details = $this->detailsService->generateDetailsFromStream($stream);
- } catch (PushInstallException $e) {
- return;
- } catch (SocialAppConfigException $e) {
- return;
- }
-
- $home = array_map(
- function(Person $item): string {
- return $item->getUserId();
- }, $details->getHomeViewers()
- );
-
- $callback = new PushCallback('social', 'timeline.home');
- $callback->setPayloadSerializable($stream);
- $callback->addUsers($home);
- $pushHelper->toCallback($callback);
-
- $direct = array_map(
- function(Person $item): string {
- return $item->getUserId();
- }, $details->getDirectViewers()
- );
-
- $callback = new PushCallback('social', 'timeline.direct');
- $callback->addUsers($direct);
- $callback->setPayloadSerializable($stream);
- $pushHelper->toCallback($callback);
+ return;
+// if ($this->miscService->getNcVersion() < 19) {
+// return;
+// }
+//
+// if (!$this->pushManager->isAvailable()) {
+// return;
+// }
+//
+// try {
+// $stream = $this->streamService->getStreamById($streamId);
+// } catch (StreamNotFoundException $e) {
+// return;
+// }
+//
+// try {
+// $pushHelper = $this->pushManager->getPushHelper();
+// $details = $this->detailsService->generateDetailsFromStream($stream);
+// } catch (PushInstallException $e) {
+// return;
+// } catch (SocialAppConfigException $e) {
+// return;
+// }
+//
+// $home = array_map(
+// function(Person $item): string {
+// return $item->getUserId();
+// }, $details->getHomeViewers()
+// );
+//
+// $callback = new PushCallback('social', 'timeline.home');
+// $callback->setPayloadSerializable($stream);
+// $callback->addUsers($home);
+// $pushHelper->toCallback($callback);
+//
+// $direct = array_map(
+// function(Person $item): string {
+// return $item->getUserId();
+// }, $details->getDirectViewers()
+// );
+//
+// $callback = new PushCallback('social', 'timeline.direct');
+// $callback->addUsers($direct);
+// $callback->setPayloadSerializable($stream);
+// $pushHelper->toCallback($callback);
}
-
- /**
- * @param $userId
- *
- * @return IPushWrapper
- * @throws PushInstallException
- */
- public function testOnAccount(string $userId): IPushWrapper {
- $pushHelper = $this->pushManager->getPushHelper();
-
- return $pushHelper->test($userId);
- }
+//
+// /**
+// * @param $userId
+// *
+// * @return IPushWrapper
+// * @throws PushInstallException
+// */
+// public function testOnAccount(string $userId): IPushWrapper {
+//// $pushHelper = $this->pushManager->getPushHelper();
+////
+//// return $pushHelper->test($userId);
+// }
}