- Модуль: mobile
- Путь к файлу: ~/bitrix/modules/mobile/classes/general/mobile_event.php
- Класс: CMobileEvent
- Вызов: CMobileEvent::shouldSendNotification
static function shouldSendNotification($message)
{
if (empty($message["USER_ID"]))
{
return false;
}
$energySave = Option::get("mobile", "push_save_energy_" . $message["USER_ID"], false);
$isMessageEmpty = empty($message["MESSAGE"]) && empty($message["ADVANCED_PARAMS"]["senderMessage"]);
if ($energySave == true && $isMessageEmpty)
{
$lastTimePushOption = "last_time_push_" . $message["USER_ID"];
$lastEmptyMessageTime = Option::get("mobile", $lastTimePushOption, 0);
$throttleTimeout = Option::get("mobile", "push_throttle_timeout", 20);
$now = time();
if (($now - $lastEmptyMessageTime) < $throttleTimeout)
{
return false;
}
else
{
Option::set("mobile", $lastTimePushOption, $now);
}
}
return true;
}