From 44770b7dca8afed67bfa4dba161c9b4bf297d40a Mon Sep 17 00:00:00 2001 From: Sergio Aristizabal Gomez Date: Wed, 28 May 2014 16:13:50 -0500 Subject: [PATCH 1/2] Check socket and ssl connection exist before closing. As the socket or the ssl connection might not be initialized when closing, we need to check its existance before doing it. --- lib/pushmeup/apns/core.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pushmeup/apns/core.rb b/lib/pushmeup/apns/core.rb index fe9d79a..66d168f 100644 --- a/lib/pushmeup/apns/core.rb +++ b/lib/pushmeup/apns/core.rb @@ -80,8 +80,8 @@ def self.with_connection rescue StandardError, Errno::EPIPE raise unless attempts < @retries - @ssl.close - @sock.close + @ssl.close unless @ssl.nil? + @sock.close unless @sock.nil? attempts += 1 retry From 0310d9be9b0d61b9af0472182120c4154a6f696d Mon Sep 17 00:00:00 2001 From: Johanna Mantilla Duque Date: Thu, 7 May 2015 16:26:50 -0500 Subject: [PATCH 2/2] Support the notification action: "category" in APNS Is a new option added in iOS8 that allow users to interact with custom functionality in the context of a user task. --- lib/pushmeup/apns/notification.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pushmeup/apns/notification.rb b/lib/pushmeup/apns/notification.rb index 60d76f6..25c7b81 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,8 +42,8 @@ def ==(that) alert == that.alert && badge == that.badge && sound == that.sound && + category == that.category && other == that.other end - end end