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

Support clearing out notifications (badge: 0) #15

Closed nathany closed 9 years ago

nathany commented 9 years ago

I don't like this particular solution because it changes the API - and not in a nice way. :frowning:

But this does provide specs for the issue. Badge: 0 and no badge have different behaviours on APNs. Right now it's not possible to clear out the badge and notifications list by sending 0 (Badge is omitempty and 0 is considered empty).

bdotdub commented 9 years ago

Yeah, this one is a tough one. I was thinking if we made a type alias like so type BadgeCount int and used sentinel values to distinguish 0 and absence of value. It ended up kind of gross and not ideal.

This seems like closest to semantically correct. :+1:

nathany commented 9 years ago

Yah. I was also thinking of a second field that flags it, and basically having an internal structure and an external API. It's not really any better than needing a pointer to an integer, which I also find kind've gross.

The unfortunate part with merging this change is that it breaks any clients of the library. Hopefully they are using godep.