Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions notify/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ type PushNotification struct {

// ref: https://github.com/sideshow/apns2/blob/54928d6193dfe300b6b88dad72b7e2ae138d4f0a/payload/builder.go#L7-L24
InterruptionLevel string `json:"interruption_level,omitempty"`
IsGRPC bool `json:"is_grpc,omitempty"`
}

// Bytes for queue message
Expand Down
16 changes: 16 additions & 0 deletions notify/notification_fcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ func GetAndroidNotification(req *PushNotification) []*messaging.Message {
}
}

// Check if the notification has a sound
if req.Sound != "" && req.IsGRPC {
req.APNS = &messaging.APNSConfig{
Payload: &messaging.APNSPayload{
Aps: &messaging.Aps{
Sound: req.Sound.(string),
},
},
}
req.Android = &messaging.AndroidConfig{
Notification: &messaging.AndroidNotification{
Sound: req.Sound.(string),
},
}
}

// Check if the notification is a topic
if req.IsTopic() {
message := &messaging.Message{
Expand Down
1 change: 1 addition & 0 deletions rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*prot
Priority: strings.ToLower(in.GetPriority().String()),
PushType: in.PushType,
Development: in.Development,
IsGRPC: true,
}

if badge > 0 {
Expand Down