Skip to content

Commit

Permalink
Merge pull request immobiliare#64 from arzynik/master
Browse files Browse the repository at this point in the history
Added iOS8 notification action support
  • Loading branch information
duccio committed Oct 23, 2014
2 parents e3129bf + fe69304 commit 8f06c1b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ApnsPHP/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ApnsPHP_Message
protected $_sText; /**< @type string Alert message to display to the user. */
protected $_nBadge; /**< @type integer Number to badge the application icon with. */
protected $_sSound; /**< @type string Sound to play. */
protected $_sCategory; /**< @type string notification category. */
protected $_bContentAvailable; /**< @type boolean True to initiates the Newsstand background download. @see http://tinyurl.com/ApplePushNotificationNewsstand */

protected $_aCustomProperties; /**< @type mixed Custom properties container. */
Expand Down Expand Up @@ -185,6 +186,26 @@ public function getSound()
{
return $this->_sSound;
}

/**
* Set the category of notification
*
* @param $sCategory @type string @optional A category for ios8 notification actions.
*/
public function setCategory($sCategory = '')
{
$this->_sCategory = $sCategory;
}

/**
* Get the category of notification
*
* @return @type string The notification category
*/
public function getCategory()
{
return $this->_sCategory;
}

/**
* Initiates the Newsstand background download.
Expand Down Expand Up @@ -353,6 +374,9 @@ protected function _getPayload()
if (isset($this->_bContentAvailable)) {
$aPayload[self::APPLE_RESERVED_NAMESPACE]['content-available'] = (int)$this->_bContentAvailable;
}
if (isset($this->_sCategory)) {
$aPayload[self::APPLE_RESERVED_NAMESPACE]['category'] = (string)$this->_sCategory;
}

if (is_array($this->_aCustomProperties)) {
foreach($this->_aCustomProperties as $sPropertyName => $mPropertyValue) {
Expand Down

0 comments on commit 8f06c1b

Please sign in to comment.