Add support for iOS 10 "mutable-content" flag.

This change mirrors the following pull request from the original PyAPNs repo:
https://github.com/djacobs/PyAPNs/pull/174
This commit is contained in:
Vadim Semenov
2016-10-10 15:04:15 +03:00
committed by Sergey Petrov
parent f79e3a6e20
commit 0b81732a4b
+5 -1
View File
@@ -43,13 +43,15 @@ class PayloadAlert(object):
class Payload(object): class Payload(object):
def __init__(self, alert=None, badge=None, sound=None, content_available=None, category=None, custom=None): def __init__(self, alert=None, badge=None, sound=None, content_available=None,
mutable_content=False, category=None, custom=None):
self.alert = alert self.alert = alert
self.badge = badge self.badge = badge
self.sound = sound self.sound = sound
self.content_available = content_available self.content_available = content_available
self.category = category self.category = category
self.custom = custom self.custom = custom
self.mutable_content = mutable_content
def dict(self): def dict(self):
result = { result = {
@@ -66,6 +68,8 @@ class Payload(object):
result['aps']['sound'] = self.sound result['aps']['sound'] = self.sound
if self.content_available: if self.content_available:
result['aps']['content-available'] = 1 result['aps']['content-available'] = 1
if self.mutable_content:
result['aps']['mutable-content'] = 1
if self.category: if self.category:
result['aps']['category'] = self.category result['aps']['category'] = self.category
if self.custom: if self.custom: