Allow APNS expiration to be 0 (#436)

This commit is contained in:
Emmet McPoland 2019-11-02 06:27:22 +00:00 committed by Bo-Yi Wu
parent 3bfcd1e822
commit d9aa8cb408
2 changed files with 3 additions and 3 deletions

View File

@ -81,7 +81,7 @@ type PushNotification struct {
Notification fcm.Notification `json:"notification,omitempty"` Notification fcm.Notification `json:"notification,omitempty"`
// iOS // iOS
Expiration int64 `json:"expiration,omitempty"` Expiration *int64 `json:"expiration,omitempty"`
ApnsID string `json:"apns_id,omitempty"` ApnsID string `json:"apns_id,omitempty"`
CollapseID string `json:"collapse_id,omitempty"` CollapseID string `json:"collapse_id,omitempty"`
Topic string `json:"topic,omitempty"` Topic string `json:"topic,omitempty"`

View File

@ -175,8 +175,8 @@ func GetIOSNotification(req PushNotification) *apns2.Notification {
CollapseID: req.CollapseID, CollapseID: req.CollapseID,
} }
if req.Expiration > 0 { if req.Expiration != nil {
notification.Expiration = time.Unix(req.Expiration, 0) notification.Expiration = time.Unix(*req.Expiration, 0)
} }
if len(req.Priority) > 0 && req.Priority == "normal" { if len(req.Priority) > 0 && req.Priority == "normal" {