Skip to content

Commit

Permalink
Merge pull request #315 from tinode/aps-service-ext
Browse files Browse the repository at this point in the history
Set MutableContent and Alert field on the FCM Aps.
  • Loading branch information
aforge authored Nov 17, 2019
2 parents 94f1296 + 17c694a commit 42e1588
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions server/push/fcm/push_fcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,26 @@ func sendNotifications(rcpt *push.Receipt, config *configType) {
} else if d.Platform == "ios" {
// iOS uses Badge to show the total unread message count.
badge := rcpt.To[uid].Unread
// Need to duplicate these in APNS.Payload.Aps.Alert so
// iOS may call NotificationServiceExtension (if present).
title := "New message"
body := data["content"]
msg.APNS = &fcm.APNSConfig{
Payload: &fcm.APNSPayload{
Aps: &fcm.Aps{Badge: &badge},
Aps: &fcm.Aps{
Badge: &badge,
MutableContent: true,
Sound: "default",
Alert: &fcm.ApsAlert{
Title: title,
Body: body,
},
},
},
}
msg.Notification = &fcm.Notification{
Title: "New message",
Body: data["content"],
Title: title,
Body: body,
}
}

Expand Down

0 comments on commit 42e1588

Please sign in to comment.