Skip to content
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

Support iOS 12 Critical Alerts #113

Merged
merged 4 commits into from Aug 14, 2018
Merged

Support iOS 12 Critical Alerts #113

merged 4 commits into from Aug 14, 2018

Conversation

ghost
Copy link

@ghost ghost commented Aug 7, 2018

The aps sound field in the APNS payload can now be a dictionary in order to send critical alerts for iOS 12 devices.

You can read about it here.

These changes add support for that as well as a test case.

cc @froodian

@coveralls
Copy link

coveralls commented Aug 7, 2018

Coverage Status

Coverage increased (+0.2%) to 91.968% when pulling 6e49bb6 on viparthasarathy:support-critical-alerts into c6554af on sideshow:master.

@ghost
Copy link
Author

ghost commented Aug 8, 2018

Created an issue for book-keeping sake.

Closes #114.

Copy link
Owner

@sideshow sideshow left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! would love to get this merged. I just added a few comments for the sake of consistency. BTW i'm curious if you guys using this library at Braze? Thanks, Adam

@@ -16,7 +16,7 @@ type aps struct {
Category string `json:"category,omitempty"`
ContentAvailable int `json:"content-available,omitempty"`
MutableContent int `json:"mutable-content,omitempty"`
Sound string `json:"sound,omitempty"`
Sound interface{} `json:"sound,omitempty"`
Copy link
Owner

Choose a reason for hiding this comment

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

Are you able to make this a sound struct similar to what I did for the alert struct.

That way for consistency with the existing they could either use like this:

payload.NewPayload().SoundName("..").SoundVolume("..")

or like this:

payload.NewPayload().Sound(map[string]interface{}{ .. })

@@ -84,7 +84,7 @@ func (p *Payload) UnsetBadge() *Payload {
// This will play a sound from the app bundle, or the default sound otherwise.
//
// {"aps":{"sound":sound}}
func (p *Payload) Sound(sound string) *Payload {
func (p *Payload) Sound(sound interface{}) *Payload {
Copy link
Owner

Choose a reason for hiding this comment

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

This can still stay as interface, that way it can accept either a string, map or the sound struct.

@ghost
Copy link
Author

ghost commented Aug 13, 2018

@sideshow Thanks for the review, I've went ahead and added a SoundName/SoundVolume interface. Yes, we're currently using this library, thanks for making it available!

@sideshow sideshow merged commit 223c93f into sideshow:master Aug 14, 2018
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.

None yet

3 participants