timehop / apns

A Go package to interface with the Apple Push Notification Service
https://godoc.org/github.com/timehop/apns
MIT License
185 stars 47 forks source link

Don't serialize Alert if all fields are blank #14

Closed nathany closed 9 years ago

nathany commented 9 years ago

closes #5

For Passbook and Newsstand notifications.

nathany commented 9 years ago

@tylrtrmbl I ended up using a pointer to Alert, but by allocating it in NewPayload there shouldn't be much of an impact on callers.

Setting APS.Alert to nil will prevent it from serializing, but I do a length check in MarshalJSON to nil it for you. Because I didn't use reflection, this list of fields needs to be maintained, such as in #9.

nathany commented 9 years ago

FYI: This will merge conflict with #9, but I can easily fix that once one of these is merged.

bdotdub commented 9 years ago

This is looking good. I dig using the conversion from APS to a map. Will merge in a few unless anyone objects

nathany commented 9 years ago

Thanks. :+1:

taylortrimble commented 9 years ago

This looks great.

nathany commented 9 years ago

@bdotdub Any changes needed or can this be merged? Thanks.