Skip to content

Commit e7f9bc4

Browse files
mtrezzaflovilmart
authored andcommitted
Added push data key for APNS key thread-id (#117)
* Added push data keys for APNS keys thread-id, urlArgs. * removed urlArgs key from push data because it is only relevant for push notifications to Safari which does not seem to be supported by parse server yet * added test for thead-id key * fixed typo in first test; added thread-id key to another test * fixed typo in test
1 parent 425d7d8 commit e7f9bc4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

spec/APNS.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ describe('APNS', () => {
166166
'content-available': 1,
167167
'mutable-content': 1,
168168
'category': 'INVITE_CATEGORY',
169+
'threadId': 'a-thread-id',
169170
'key': 'value',
170171
'keyAgain': 'valueAgain'
171172
};
@@ -180,6 +181,7 @@ describe('APNS', () => {
180181
expect(notification.aps['content-available']).toEqual(1);
181182
expect(notification.aps['mutable-content']).toEqual(1);
182183
expect(notification.aps.category).toEqual(data.category);
184+
expect(notification.aps['thread-id']).toEqual(data.threadId);
183185
expect(notification.payload).toEqual({
184186
'key': 'value',
185187
'keyAgain': 'valueAgain'
@@ -198,7 +200,8 @@ describe('APNS', () => {
198200
"loc-args" : [ "Jenna", "Frank"]
199201
},
200202
'badge': 100,
201-
'sound': 'test'
203+
'sound': 'test',
204+
'thread-id': 'a-thread-id'
202205
},
203206
'key': 'value',
204207
'keyAgain': 'valueAgain'
@@ -217,6 +220,7 @@ describe('APNS', () => {
217220
expect(jsonObject.aps.alert).toEqual({ "loc-key" : "GAME_PLAY_REQUEST_FORMAT", "loc-args" : [ "Jenna", "Frank"] });
218221
expect(jsonObject.aps.badge).toEqual(100);
219222
expect(jsonObject.aps.sound).toEqual('test');
223+
expect(jsonObject.aps['thread-id']).toEqual('a-thread-id');
220224
expect(jsonObject.key).toEqual('value');
221225
expect(jsonObject.keyAgain).toEqual('valueAgain');
222226
done();

src/APNS.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ export class APNS {
200200
case 'category':
201201
notification.setCategory(coreData.category);
202202
break;
203+
case 'threadId':
204+
notification.setThreadId(coreData.threadId);
205+
break;
203206
default:
204207
payload[key] = coreData[key];
205208
break;

0 commit comments

Comments
 (0)