Only allow ios push messages to go through APNS client service #162

This commit is contained in:
Kendrick Chan 2018-08-17 03:34:46 +08:00
parent 30e08259db
commit 317ac19c52
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,14 @@
<?php
namespace App\Ramcar;
class MobileOSType extends NameValue
{
const ANDROID = 'ANDROID';
const IOS = 'IOS';
const COLLECTION = [
'IOS' => 'iOS',
'ANDROID' => 'Android',
];
}

View file

@ -4,6 +4,7 @@ namespace App\Service;
use Mosquitto\Client as MosquittoClient;
use App\Entity\JobOrder;
use App\Ramcar\MobileOSType;
use Redis;
class APNSClient
@ -43,6 +44,10 @@ class APNSClient
foreach ($sessions as $sess)
{
// check if mobile session is using an ios device
if ($sess->getOSType() != MobileOSType::IOS)
continue;
$push_id = $sess->getDevicePushID();
if ($push_id != null && strlen(trim($push_id)) > 0)
$this->push($push_id, $message);