From b60fc023669a86f4fdc298d36650ccaee92350ba Mon Sep 17 00:00:00 2001
From: kdelinx <kdelinx@gmail.com>
Date: Tue, 25 Apr 2017 16:42:33 +0300
Subject: [PATCH] added param thread_id in Payload for iOS 10

---
 apns.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/apns.py b/apns.py
index 906fdee..5d9e30e 100644
--- a/apns.py
+++ b/apns.py
@@ -299,13 +299,14 @@ def __init__(self, payload_size):
 class Payload(object):
     """A class representing an APNs message payload"""
     def __init__(self, alert=None, badge=None, sound=None, category=None, custom=None, content_available=False,
-                 mutable_content=False):
+                 mutable_content=False, thread_id=None):
         super(Payload, self).__init__()
         self.alert = alert
         self.badge = badge
         self.sound = sound
         self.category = category
         self.custom = custom
+        self.thread_id = thread_id
         self.content_available = content_available
         self.mutable_content = mutable_content
         self._check_size()
@@ -327,13 +328,16 @@ def dict(self):
         if self.category:
             d['category'] = self.category
 
+        if self.thread_id:
+            d.update({'thread_id': self.thread_id})
+
         if self.content_available:
             d.update({'content-available': 1})
 
         if self.mutable_content:
             d.update({'mutable-content': 1})
 
-        d = { 'aps': d }
+        d = {'aps': d}
         if self.custom:
             d.update(self.custom)
         return d