diff --git a/ApnsPHP/Message.php b/ApnsPHP/Message.php index 70735c17..b48667cd 100644 --- a/ApnsPHP/Message.php +++ b/ApnsPHP/Message.php @@ -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. */ @@ -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. @@ -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) {