From b17d1121cdcab67b62aaf788e25713f2596c38d8 Mon Sep 17 00:00:00 2001 From: Luciuz Date: Tue, 21 Feb 2017 15:49:09 +0300 Subject: [PATCH 1/3] Update Gcm.php add errors on sendMulti --- Gcm.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Gcm.php b/Gcm.php index f0bf04b..9e3aa57 100644 --- a/Gcm.php +++ b/Gcm.php @@ -153,8 +153,12 @@ public function sendMulti($tokens, $text, $payloadData = [], $args = []) try { // send a message $result = $this->getClient()->sendMulti($message, $tokens, $this->retryTimes); - $this->success = $result->getSuccess(); + if (!$this->success) { + foreach($result->getResults() as $r) { + $this->errors[] = $r->getErrorCode(); + } + } } catch (\InvalidArgumentException $e) { $this->errors[] = $e->getMessage(); // $deviceRegistrationId was null From 52941ea395935ba82460a9899a21c2a8652aa87c Mon Sep 17 00:00:00 2001 From: Luciuz Date: Tue, 21 Feb 2017 16:10:37 +0300 Subject: [PATCH 2/3] Update Gcm.php add correct index to errors (0 - for an exception message, 1,2,3,... - for push tokens) --- Gcm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gcm.php b/Gcm.php index 9e3aa57..d491778 100644 --- a/Gcm.php +++ b/Gcm.php @@ -155,8 +155,8 @@ public function sendMulti($tokens, $text, $payloadData = [], $args = []) $result = $this->getClient()->sendMulti($message, $tokens, $this->retryTimes); $this->success = $result->getSuccess(); if (!$this->success) { - foreach($result->getResults() as $r) { - $this->errors[] = $r->getErrorCode(); + foreach($result->getResults() as $i => $r) { + $this->errors[$i+1] = $r->getErrorCode(); } } } catch (\InvalidArgumentException $e) { From f5de2f7511dc24b9f695dd9f35128ffdfe2e11c6 Mon Sep 17 00:00:00 2001 From: Luciuz Date: Tue, 21 Feb 2017 16:20:20 +0300 Subject: [PATCH 3/3] Update Gcm.php fix --- Gcm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gcm.php b/Gcm.php index d491778..c4f798e 100644 --- a/Gcm.php +++ b/Gcm.php @@ -155,7 +155,7 @@ public function sendMulti($tokens, $text, $payloadData = [], $args = []) $result = $this->getClient()->sendMulti($message, $tokens, $this->retryTimes); $this->success = $result->getSuccess(); if (!$this->success) { - foreach($result->getResults() as $i => $r) { + foreach ($result->getResults() as $i => $r) { $this->errors[$i+1] = $r->getErrorCode(); } }