From fb6379aa1eacb75aec6dddc1d53898c8dd5dad3c Mon Sep 17 00:00:00 2001 From: Thomas Maurer Date: Fri, 10 Apr 2015 12:13:32 +0200 Subject: [PATCH] + Add category to APNS notification --- lib/pushmeup/apns/notification.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pushmeup/apns/notification.rb b/lib/pushmeup/apns/notification.rb index 60d76f6..65d3e87 100644 --- a/lib/pushmeup/apns/notification.rb +++ b/lib/pushmeup/apns/notification.rb @@ -1,6 +1,6 @@ module APNS class Notification - attr_accessor :device_token, :alert, :badge, :sound, :other + attr_accessor :device_token, :alert, :badge, :sound, :category, :other def initialize(device_token, message) self.device_token = device_token @@ -8,6 +8,7 @@ def initialize(device_token, message) self.alert = message[:alert] self.badge = message[:badge] self.sound = message[:sound] + self.category = message[:category] self.other = message[:other] elsif message.is_a?(String) self.alert = message @@ -31,6 +32,7 @@ def packaged_message aps['aps']['alert'] = self.alert if self.alert aps['aps']['badge'] = self.badge if self.badge aps['aps']['sound'] = self.sound if self.sound + aps['aps']['category'] = self.category if self.category aps.merge!(self.other) if self.other aps.to_json.gsub(/\\u([\da-fA-F]{4})/) {|m| [$1].pack("H*").unpack("n*").pack("U*")} end @@ -40,6 +42,7 @@ def ==(that) alert == that.alert && badge == that.badge && sound == that.sound && + category == that.category && other == that.other end