From 38866ff6f01a9f9d55785e861a53d869dc231841 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 17 May 2016 14:35:16 +0300 Subject: [PATCH] Disabled iOS push notifications by default --- app/Http/routes.php | 3 +-- app/Ninja/Notifications/PushFactory.php | 7 +++---- app/Services/PushService.php | 6 +++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Http/routes.php b/app/Http/routes.php index ca6268b355..a6002f5d8d 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -631,8 +631,7 @@ if (!defined('CONTACT_EMAIL')) { define('DEFAULT_API_PAGE_SIZE', 15); define('MAX_API_PAGE_SIZE', 100); - define('IOS_PRODUCTION_PUSH', env('IOS_PRODUCTION_PUSH', 'ninjaIOS')); - define('IOS_DEV_PUSH', env('IOS_DEV_PUSH', 'devNinjaIOS')); + define('IOS_PUSH_CERTIFICATE', env('IOS_PUSH_CERTIFICATE', '')); define('TOKEN_BILLING_DISABLED', 1); define('TOKEN_BILLING_OPT_IN', 2); diff --git a/app/Ninja/Notifications/PushFactory.php b/app/Ninja/Notifications/PushFactory.php index 7f882ff1d0..723ff824de 100644 --- a/app/Ninja/Notifications/PushFactory.php +++ b/app/Ninja/Notifications/PushFactory.php @@ -19,13 +19,12 @@ class PushFactory * * Static variables defined in routes.php * - * IOS_PRODUCTION_PUSH - * IOS_DEV_PUSH + * IOS_PUSH_CERTIFICATE */ public function __construct() { - $this->certificate = IOS_DEV_PUSH; + $this->certificate = IOS_PUSH_CERTIFICATE; } /** @@ -93,4 +92,4 @@ class PushFactory return $feedback->getFeedback(); } -} \ No newline at end of file +} diff --git a/app/Services/PushService.php b/app/Services/PushService.php index 17151f93af..a96042b924 100644 --- a/app/Services/PushService.php +++ b/app/Services/PushService.php @@ -41,6 +41,10 @@ class PushService public function sendNotification($invoice, $type) { + if (! IOS_PUSH_CERTIFICATE) { + return; + } + //check user has registered for push notifications if(!$this->checkDeviceExists($invoice->account)) return; @@ -168,4 +172,4 @@ class PushService -} \ No newline at end of file +}