lib/ProMotion/delegate/delegate_notifications.rb in ProMotion-1.0.4 vs lib/ProMotion/delegate/delegate_notifications.rb in ProMotion-1.1.0.rc1
- old
+ new
@@ -25,14 +25,14 @@
def registered_push_notifications
mask = UIApplication.sharedApplication.enabledRemoteNotificationTypes
types = []
- types << :badge if mask & UIRemoteNotificationTypeBadge
- types << :sound if mask & UIRemoteNotificationTypeSound
- types << :alert if mask & UIRemoteNotificationTypeAlert
- types << :newsstand if mask & UIRemoteNotificationTypeNewsstandContentAvailability
+ types << :badge if mask & UIRemoteNotificationTypeBadge > 0
+ types << :sound if mask & UIRemoteNotificationTypeSound > 0
+ types << :alert if mask & UIRemoteNotificationTypeAlert > 0
+ types << :newsstand if mask & UIRemoteNotificationTypeNewsstandContentAvailability > 0
types
end
def received_push_notification(notification, was_launched)
@@ -49,14 +49,14 @@
def application(application, didFailToRegisterForRemoteNotificationsWithError:error)
on_push_registration(nil, error) if respond_to?(:on_push_registration)
end
def application(application, didReceiveRemoteNotification:notification)
- received_push_notification(notification, false)
+ received_push_notification(notification, application.applicationState != UIApplicationStateActive)
end
-
+
protected
-
+
def map_notification_symbol(symbol)
{
none: UIRemoteNotificationTypeNone,
badge: UIRemoteNotificationTypeBadge,
sound: UIRemoteNotificationTypeSound,