Skip to content

Add support for passing collapse-id to APNS #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2017
Merged

Add support for passing collapse-id to APNS #79

merged 2 commits into from
May 10, 2017

Conversation

Amnell
Copy link
Contributor

@Amnell Amnell commented May 8, 2017

Added support for adding apns-collapse-id to enable collapsing of pushes just like the apns-expiration.

I changed the method signature for APNS_generateNotification from APNS._generateNotification(data, expirationDate) to APNS._generateNotification(data, headers) making it easier to add more header properties in the future.

headers

The headers parameter is a JS object with the following supported properties:

  • expirationTime
  • collapseID
  • topic

Don't hesitate to feedback on the code as JS isn't my "native" language :)

@codecov
Copy link

codecov bot commented May 8, 2017

Codecov Report

Merging #79 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #79   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           5      5           
  Lines         249    252    +3     
=====================================
+ Hits          249    252    +3
Impacted Files Coverage Δ
src/APNS.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68c9742...4b6dc09. Read the comment docs.

@flovilmart
Copy link
Contributor

Thanks for the PR. Can you provide links to the docs from the APN lib as well as apple's so I can doublecheck if it's implemented as expected?

@Amnell
Copy link
Contributor Author

Amnell commented May 8, 2017

src/APNS.js Outdated
@@ -95,7 +96,8 @@ export class APNS {
continue;
}

let notification = APNS._generateNotification(coreData, expirationTime, appIdentifier);
let headers = { expirationTime: expirationTime, appIdentifier: appIdentifier, collapseId: collapseId }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the appIdentifier header should be renamed topic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Good spot 👍

@flovilmart
Copy link
Contributor

Thanks for the docs! Very helpful :) Just one small nit.

@flovilmart
Copy link
Contributor

Looking great! thanks!

@flovilmart flovilmart merged commit cb8c98f into parse-community:master May 10, 2017
@Amnell Amnell deleted the feature/apns-collapse-id branch October 26, 2017 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants