diff --git a/gorush/notification.go b/gorush/notification.go index 7fa21c4..f98b10e 100644 --- a/gorush/notification.go +++ b/gorush/notification.go @@ -67,9 +67,6 @@ type RequestPushNotification struct { URLArgs []string `json:"url-args,omitempty"` Extend []ExtendJSON `json:"extend,omitempty"` Alert Alert `json:"alert,omitempty"` - - // meta - IDs []uint64 `json:"seq_id,omitempty"` } func CheckPushConf() error { @@ -178,10 +175,9 @@ func GetIOSNotification(req RequestPushNotification) *apns.Notification { payload.AlertTitleLocKey(req.Alert.TitleLocKey) } - // Need send PR to apns2 repo. - // if len(req.Alert.LocArgs) > 0 { - // payload.AlertLocArgs(req.Alert.LocArgs) - // } + if len(req.Alert.LocArgs) > 0 { + payload.AlertLocArgs(req.Alert.LocArgs) + } if len(req.Alert.TitleLocArgs) > 0 { payload.AlertTitleLocArgs(req.Alert.TitleLocArgs) diff --git a/gorush/notification_test.go b/gorush/notification_test.go index 45173f4..ba5f897 100644 --- a/gorush/notification_test.go +++ b/gorush/notification_test.go @@ -156,6 +156,7 @@ func TestIOSAlertNotificationStructure(t *testing.T) { aps := dat["aps"].(map[string]interface{}) alert := aps["alert"].(map[string]interface{}) titleLocArgs := alert["title-loc-args"].([]interface{}) + locArgs := alert["loc-args"].([]interface{}) assert.Equal(t, test, action) assert.Equal(t, test, actionLocKey) @@ -166,6 +167,8 @@ func TestIOSAlertNotificationStructure(t *testing.T) { assert.Equal(t, test, titleLocKey) assert.Contains(t, titleLocArgs, "a") assert.Contains(t, titleLocArgs, "b") + assert.Contains(t, locArgs, "a") + assert.Contains(t, locArgs, "b") } func TestAndroidNotificationStructure(t *testing.T) {