Skip to content

Commit

Permalink
Fixed app_id bug in parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayk committed Sep 22, 2017
1 parent d682a5b commit 543f042
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/OneSignalClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class OneSignalClient
const ENDPOINT_NOTIFICATIONS = "/notifications";
const ENDPOINT_PLAYERS = "/players";

private $client;
private $headers;
private $appId;
private $restApiKey;
private $userAuthKey;
private $additionalParams;
protected $client;
protected $headers;
protected $appId;
protected $restApiKey;
protected $userAuthKey;
protected $additionalParams;

/**
* @var bool
Expand Down Expand Up @@ -217,12 +217,13 @@ public function sendNotificationToSegment($message, $segment, $url = null, $data
public function sendNotificationCustom($parameters = []){
$this->requiresAuth();
$this->usesJSON();
// By Sucipto

if (isset($parameters['api_key'])) {
$this->headers['headers']['Authorization'] = 'Basic '.$parameters['api_key'];
}

// Make sure to use app_id
if (!$parameters['app_id']) {
if (!isset($parameters['app_id'])) {
$parameters['app_id'] = $this->appId;
}

Expand Down

0 comments on commit 543f042

Please sign in to comment.