From dbc57cd828005b441814d6b72808750a04577a15 Mon Sep 17 00:00:00 2001 From: Emmet McPoland Date: Fri, 7 Feb 2020 03:50:20 +0000 Subject: [PATCH] Allow ability to explicitly set APNS priority (#437) Co-authored-by: Bo-Yi Wu --- gorush/notification_apns.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gorush/notification_apns.go b/gorush/notification_apns.go index ce13920..6c6f6b5 100644 --- a/gorush/notification_apns.go +++ b/gorush/notification_apns.go @@ -247,8 +247,12 @@ func GetIOSNotification(req PushNotification) *apns2.Notification { notification.Expiration = time.Unix(*req.Expiration, 0) } - if len(req.Priority) > 0 && req.Priority == "normal" { - notification.Priority = apns2.PriorityLow + if len(req.Priority) > 0 { + if req.Priority == "normal" { + notification.Priority = apns2.PriorityLow + } else if req.Priority == "high" { + notification.Priority = apns2.PriorityHigh + } } if len(req.PushType) > 0 {