Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/pull/lib/push/service/ |
Upload File : |
<?php namespace Bitrix\Pull\Push\Service; use Bitrix\Pull\Push\Message\AppleMessage; class Apple extends BaseService { protected int $sandboxModifier = 1; protected int $productionModifier = 2; /** * Gets the batch for Apple push notification service * * @param array $messages * * @return string */ public function getBatch(array $messages = []): string { $arGroupedMessages = self::getGroupedByServiceMode($messages); if (empty($arGroupedMessages)) { return ''; } $batch = $this->getProductionBatch($arGroupedMessages["PRODUCTION"]); $batch .= $this->getSandboxBatch($arGroupedMessages["SANDBOX"]); return $batch; } /** * Returns message instance */ function getMessageInstance(string $token): AppleMessage { return new AppleMessage($token, 4096); } /** * Gets batch with ;1; modifier only for sandbox server * * @param $appMessages * * @return string */ public function getSandboxBatch($appMessages) { return $this->getBatchWithModifier($appMessages, ";" . $this->sandboxModifier . ";"); } /** * Gets batch with ;2; modifier only for production server * * @param $appMessages * * @return string */ public function getProductionBatch($appMessages) { return $this->getBatchWithModifier($appMessages, ";" . $this->productionModifier . ";"); } public static function shouldBeSent(array $messageRowData): bool { $params = $messageRowData["ADVANCED_PARAMS"]; return !($params && !$params["senderName"] && mb_strlen($params["senderMessage"]) > 0); } }