feat: improve group member events and push delivery
This commit is contained in:
@@ -158,7 +158,7 @@ func PrepareV1Notifications(rcpt *push.Receipt, config *configType) ([]*fcmv1.Me
|
||||
for uid, devList := range devices {
|
||||
topic := rcpt.Payload.Topic
|
||||
userData := data
|
||||
if rcpt.To[uid].Delivered > 0 {
|
||||
if rcpt.To[uid].Delivered > 0 || rcpt.To[uid].Silent {
|
||||
userData = clonePayload(data)
|
||||
// Silence the push for user who have received the data interactively.
|
||||
userData["silent"] = "true"
|
||||
|
||||
@@ -351,7 +351,7 @@ func preparePayloads(rcpt *push.Receipt, config *configType) ([]*jpushPayload, [
|
||||
for _, uid := range uids {
|
||||
recipient := rcpt.To[uid]
|
||||
userData := cloneData(data)
|
||||
if recipient.Delivered > 0 {
|
||||
if recipient.Delivered > 0 || recipient.Silent {
|
||||
userData["silent"] = "true"
|
||||
}
|
||||
topic := rcpt.Payload.Topic
|
||||
|
||||
@@ -28,6 +28,8 @@ type Recipient struct {
|
||||
Delivered int `json:"delivered"`
|
||||
// List of user's devices that the packet was delivered to (if known). Len(Devices) >= Delivered
|
||||
Devices []string `json:"devices,omitempty"`
|
||||
// Deliver as a data-only notification without showing an alert.
|
||||
Silent bool `json:"silent,omitempty"`
|
||||
// Unread count to include in the push
|
||||
Unread int `json:"unread"`
|
||||
// Indicates whether unread counter in the cache should be incremented before sending the push.
|
||||
|
||||
Reference in New Issue
Block a user