fix(grpc): check alert exist. (#324)

* fix(grpc): check alert exist.

* fix: update readme.
This commit is contained in:
Bo-Yi Wu
2018-01-03 17:08:28 +08:00
committed by GitHub
parent 3b30bb6346
commit 651a2b76db
7 changed files with 322 additions and 294 deletions

View File

@@ -57,12 +57,18 @@ func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*prot
Topic: in.Topic,
APIKey: in.Key,
Category: in.Category,
Badge: &badge,
Alert: gorush.Alert{
}
if badge > 0 {
notification.Badge = &badge
}
if in.Alert != nil {
notification.Alert = gorush.Alert{
Title: in.Alert.Title,
Body: in.Alert.Body,
Subtitle: in.Alert.Subtitle,
},
}
}
go gorush.SendNotification(notification)