Add support for Safari Push Notifications
This commit is contained in:
+8
-2
@@ -4,7 +4,7 @@ MAX_PAYLOAD_SIZE = 4096
|
||||
class PayloadAlert(object):
|
||||
def __init__(self, title=None, title_localized_key=None, title_localized_args=None,
|
||||
body=None, body_localized_key=None, body_localized_args=None,
|
||||
action_localized_key=None,
|
||||
action_localized_key=None, action=None,
|
||||
launch_image=None):
|
||||
self.title = title
|
||||
self.title_localized_key = title_localized_key
|
||||
@@ -13,6 +13,7 @@ class PayloadAlert(object):
|
||||
self.body_localized_key = body_localized_key
|
||||
self.body_localized_args = body_localized_args
|
||||
self.action_localized_key = action_localized_key
|
||||
self.action = action
|
||||
self.launch_image = launch_image
|
||||
|
||||
def dict(self):
|
||||
@@ -34,6 +35,8 @@ class PayloadAlert(object):
|
||||
|
||||
if self.action_localized_key:
|
||||
result['action-loc-key'] = self.action_localized_key
|
||||
if self.action:
|
||||
result['action'] = self.action
|
||||
|
||||
if self.launch_image:
|
||||
result['launch-image'] = self.launch_image
|
||||
@@ -44,12 +47,13 @@ class PayloadAlert(object):
|
||||
class Payload(object):
|
||||
def __init__(self, alert=None, badge=None, sound=None,
|
||||
content_available=False, mutable_content=False,
|
||||
category=None, custom=None):
|
||||
category=None, url_args=None, custom=None):
|
||||
self.alert = alert
|
||||
self.badge = badge
|
||||
self.sound = sound
|
||||
self.content_available = content_available
|
||||
self.category = category
|
||||
self.url_args = url_args
|
||||
self.custom = custom
|
||||
self.mutable_content = mutable_content
|
||||
|
||||
@@ -72,6 +76,8 @@ class Payload(object):
|
||||
result['aps']['mutable-content'] = 1
|
||||
if self.category is not None:
|
||||
result['aps']['category'] = self.category
|
||||
if self.url_args is not None:
|
||||
result['aps']['url-args'] = self.url_args
|
||||
if self.custom is not None:
|
||||
result.update(self.custom)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user