feat(ios12): Add support for Summary arguments in notifications (#384)

* feat(ios12): Add support for Summary arguments in notifications

* feat: upgrade go module
This commit is contained in:
Bo-Yi Wu
2018-11-20 11:02:26 +08:00
committed by GitHub
parent 49a81edbd0
commit 375eec1d90
7 changed files with 99 additions and 32 deletions

View File

@@ -22,16 +22,18 @@ type aps struct {
}
type alert struct {
Action string `json:"action,omitempty"`
ActionLocKey string `json:"action-loc-key,omitempty"`
Body string `json:"body,omitempty"`
LaunchImage string `json:"launch-image,omitempty"`
LocArgs []string `json:"loc-args,omitempty"`
LocKey string `json:"loc-key,omitempty"`
Title string `json:"title,omitempty"`
Subtitle string `json:"subtitle,omitempty"`
TitleLocArgs []string `json:"title-loc-args,omitempty"`
TitleLocKey string `json:"title-loc-key,omitempty"`
Action string `json:"action,omitempty"`
ActionLocKey string `json:"action-loc-key,omitempty"`
Body string `json:"body,omitempty"`
LaunchImage string `json:"launch-image,omitempty"`
LocArgs []string `json:"loc-args,omitempty"`
LocKey string `json:"loc-key,omitempty"`
Title string `json:"title,omitempty"`
Subtitle string `json:"subtitle,omitempty"`
TitleLocArgs []string `json:"title-loc-args,omitempty"`
TitleLocKey string `json:"title-loc-key,omitempty"`
SummaryArg string `json:"summary-arg,omitempty"`
SummaryArgCount int `json:"summary-arg-count,omitempty"`
}
type sound struct {
@@ -235,13 +237,35 @@ func (p *Payload) AlertActionLocKey(key string) *Payload {
return p
}
// AlertSummaryArg sets the aps alert summary arg key on the payload.
// This is the string that is used as a key to fill in an argument
// at the bottom of a notification to provide more context, such as
// a name associated with the sender of the notification.
//
// {"aps":{"alert":{"summary-arg":key}}}
func (p *Payload) AlertSummaryArg(key string) *Payload {
p.aps().alert().SummaryArg = key
return p
}
// AlertSummaryArgCount sets the aps alert summary arg count key on the payload.
// This integer sets a custom "weight" on the notification, effectively
// allowing a notification to be viewed internally as two. For example if
// a notification encompasses 3 messages, you can set it to 3.
//
// {"aps":{"alert":{"summary-arg-count":key}}}
func (p *Payload) AlertSummaryArgCount(key int) *Payload {
p.aps().alert().SummaryArgCount = key
return p
}
// General
// Category sets the aps category on the payload.
// This is a string value that represents the identifier property of the
// UIMutableUserNotificationCategory object you created to define custom actions.
//
// {"aps":{"alert":{"category":category}}}
// {"aps":{"category":category}}
func (p *Payload) Category(category string) *Payload {
p.aps().Category = category
return p

18
vendor/vendor.json vendored
View File

@@ -449,22 +449,22 @@
{
"checksumSHA1": "DL5vX9aOefzIAxMDdaQBtgRdR0Y=",
"path": "github.com/sideshow/apns2",
"revision": "3c5d4af1700ed9111ecb16a9a99a92a00c8b2f27",
"revisionTime": "2018-08-27T05:51:07Z",
"version": "master",
"versionExact": "master"
"revision": "5c6f7afc0242dbeab1c0b26a1efd761a67228004",
"revisionTime": "2018-10-12T08:22:23Z",
"version": "v0.15",
"versionExact": "v0.15"
},
{
"checksumSHA1": "EHOwwdWPJGt1vNVeJxyRDRHBhl8=",
"path": "github.com/sideshow/apns2/certificate",
"revision": "c6554aff77e6e5580dec977c8c33cc238f329ab0",
"revisionTime": "2018-04-13T21:53:35Z"
"revision": "060d44b53d05502e715958efde28063cd0746dba",
"revisionTime": "2018-10-14T01:24:05Z"
},
{
"checksumSHA1": "36bPwB1aiQCxfmdwfgYmI89I9nI=",
"checksumSHA1": "uwySZ0Z4LZ+9PIYqg7twpCQxv+I=",
"path": "github.com/sideshow/apns2/payload",
"revision": "3c5d4af1700ed9111ecb16a9a99a92a00c8b2f27",
"revisionTime": "2018-08-27T05:51:07Z"
"revision": "060d44b53d05502e715958efde28063cd0746dba",
"revisionTime": "2018-10-14T01:24:05Z"
},
{
"checksumSHA1": "nkQ/1JoIY4jh8XlI8LClfFVux9U=",