Skip to content

Commit

Permalink
Prevent empty push notifications from being discarded by Apple
Browse files Browse the repository at this point in the history
  • Loading branch information
Finb committed Dec 12, 2024
1 parent 63bdc6a commit 1010a48
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions route_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ func push(c *fiber.Ctx, params map[string]interface{}) error {
return c.Status(400).JSON(failed(400, "device key is empty"))
}

if msg.Body == "" && msg.Title == "" && msg.Subtitle == "" {
msg.Body = "Empty message"
}

deviceToken, err := db.DeviceTokenByKey(msg.DeviceKey)
if err != nil {
return c.Status(400).JSON(failed(400, "failed to get device token: %v", err))
Expand Down

0 comments on commit 1010a48

Please sign in to comment.