add ContentAvailable.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-03-25 09:34:22 +08:00
parent c940f64650
commit c856edaa18
1 changed files with 7 additions and 0 deletions

View File

@ -19,10 +19,13 @@ type RequestPushNotification struct {
Platform int `json:"platform" binding:"required"`
Message string `json:"message" binding:"required"`
Priority string `json:"priority,omitempty"`
ContentAvailable bool `json:"content_available,omitempty"`
// Android
CollapseKey string `json:"collapse_key,omitempty"`
DelayWhileIdle bool `json:"delay_while_idle,omitempty"`
TimeToLive int `json:"time_to_live,omitempty"`
// iOS
ApnsID string `json:"apns_id,omitempty"`
Topic string `json:"topic,omitempty"`
@ -88,6 +91,10 @@ func pushNotificationIos(req RequestPushNotification, client *apns.Client) bool
payload.Sound(req.Sound)
}
if req.ContentAvailable {
payload.ContentAvailable()
}
if len(req.Extend) > 0 {
for _, extend := range req.Extend {
payload.Custom(extend.Key, extend.Value)