Adding apns-push-type header

This commit is contained in:
meteran
2019-08-07 19:26:43 +03:00
committed by Sergey Petrov
parent fde28abb04
commit 3e9a191f4b
3 changed files with 27 additions and 1 deletions
+4 -1
View File
@@ -96,7 +96,10 @@ class APNsClient(object):
json_str = json.dumps(notification.dict(), cls=self.__json_encoder, ensure_ascii=False, separators=(',', ':'))
json_payload = json_str.encode('utf-8')
headers = {}
headers = {
'apns-push-type': notification.push_type
}
if topic is not None:
headers['apns-topic'] = topic
+4
View File
@@ -77,6 +77,10 @@ class Payload(object):
self.mutable_content = mutable_content
self.thread_id = thread_id
self.push_type = 'background'
if self.alert or self.badge is not None or self.sound is not None:
self.push_type = 'alert'
def dict(self) -> Dict[str, Any]:
result = {
'aps': {}