lib/rapnd/notification.rb in rapnd-0.1.9 vs lib/rapnd/notification.rb in rapnd-0.1.10
- old
+ new
@@ -9,12 +9,16 @@
raise 'Must provide device token' if self.device_token.nil?
self.device_token = self.device_token.delete(' ')
end
def payload
- p = Hash.new
- [:badge, :alert, :sound].each do |k|
- p[k] = send(k) if send(k)
+ if badge.nil? && sound.nil?
+ p = alert
+ else
+ p = Hash.new
+ [:badge, :alert, :sound].each do |k|
+ p[k] = send(k) if send(k)
+ end
end
aps = {:aps => p}
aps.merge!(custom) if custom
aps
end
\ No newline at end of file