From 8804c3d30cd9a2f034a51e0f3076fc373d77bebe Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Fri, 22 Jun 2018 18:25:48 +0200 Subject: [PATCH 1/2] Add prioritization for Talk Signed-off-by: Mario Danic --- lib/Push.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Push.php b/lib/Push.php index 1213d7f8f..f03349e77 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -190,6 +190,12 @@ protected function encryptAndSign(Key $userKey, array $device, INotification $no 'id' => $notification->getObjectId(), ]; + if ($isTalkNotification) { + $priority = "high"; + } else { + $priority = "normal"; + } + if (!openssl_public_encrypt(json_encode($data), $encryptedSubject, $device['devicepublickey'], OPENSSL_PKCS1_PADDING)) { $this->log->error(openssl_error_string(), ['app' => 'notifications']); throw new \InvalidArgumentException('Failed to encrypt message for device'); @@ -204,6 +210,7 @@ protected function encryptAndSign(Key $userKey, array $device, INotification $no 'pushTokenHash' => $device['pushtokenhash'], 'subject' => $base64EncryptedSubject, 'signature' => $base64Signature, + 'priority' => $priority, ]; } From 0d60e73e66f5bf11eb7ca82ad176380cef270f5f Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Wed, 11 Jul 2018 10:24:19 +0200 Subject: [PATCH 2/2] Use single quotes Signed-off-by: Mario Danic --- lib/Push.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Push.php b/lib/Push.php index f03349e77..61b802e22 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -191,9 +191,9 @@ protected function encryptAndSign(Key $userKey, array $device, INotification $no ]; if ($isTalkNotification) { - $priority = "high"; + $priority = 'high'; } else { - $priority = "normal"; + $priority = 'normal'; } if (!openssl_public_encrypt(json_encode($data), $encryptedSubject, $device['devicepublickey'], OPENSSL_PKCS1_PADDING)) {