mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 11:47:42 +00:00
Add custom field with account list
This commit is contained in:
parent
233e66e9a7
commit
ebd5fce678
1 changed files with 3 additions and 1 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/dustin/go-humanize/english"
|
"github.com/dustin/go-humanize/english"
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
|
@ -67,13 +68,14 @@ func (a *api) testDeviceHandler(w http.ResponseWriter, r *http.Request, ps httpr
|
||||||
users = append(users, user)
|
users = append(users, user)
|
||||||
}
|
}
|
||||||
|
|
||||||
body := fmt.Sprintf("Active usernames are: %s", english.OxfordWordSeries(users, "and"))
|
body := fmt.Sprintf("Active usernames are: %s. Tap me for more info!", english.OxfordWordSeries(users, "and"))
|
||||||
notification := &apns2.Notification{}
|
notification := &apns2.Notification{}
|
||||||
notification.Topic = "com.christianselig.Apollo"
|
notification.Topic = "com.christianselig.Apollo"
|
||||||
notification.DeviceToken = d.APNSToken
|
notification.DeviceToken = d.APNSToken
|
||||||
notification.Payload = payload.
|
notification.Payload = payload.
|
||||||
NewPayload().
|
NewPayload().
|
||||||
Category("test-notification").
|
Category("test-notification").
|
||||||
|
Custom("test_accounts", strings.Join(users, ",")).
|
||||||
AlertTitle(notificationTitle).
|
AlertTitle(notificationTitle).
|
||||||
AlertBody(body)
|
AlertBody(body)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue