Support ios LocArgs.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-04-08 15:31:58 +08:00
parent 5c9802bc9f
commit 227c8ff582
2 changed files with 6 additions and 7 deletions

View File

@ -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)

View File

@ -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) {