Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Added APNs interruption-level parameter #160

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The JSON below is the request-body example.
"content_available" : false,
"mutable_content" : false,
"expiry" : 10,
"interruption": "active",
"extend" : [{ "key": "url", "val": "..." }, { "key": "intent", "val": "..." }]
},
{
Expand Down Expand Up @@ -71,6 +72,7 @@ The request-body must have the `notifications` array. Table below shows the para
|extend |string array|extensible partition |- | | |
|identifier |string |notification identifier |- | |an optional value to identify notification|
|push_type |string |apns-push-type |- |alert |only iOS(13.0+) |
|interruption |string |the importance and delivery timing of a notification|- |active |onlt iOS(15.0+) |

The JSON below is the response-body example from Gaurun. In this case, the status is 200(OK).

Expand Down
7 changes: 7 additions & 0 deletions buford/payload/aps.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ type APS struct {
// Mutable is used for Service Extensions introduced in iOS 10.
MutableContent bool

// Interruption is the importance and delivery timing of a notification.
// The string values “passive”, “active”, “time-sensitive”, or “critical”
Interruption string

// Thread identifier to create notification groups in iOS 12 or newer.
ThreadID string
}
Expand Down Expand Up @@ -96,6 +100,9 @@ func (a *APS) Map() map[string]interface{} {
if a.MutableContent {
aps["mutable-content"] = 1
}
if a.Interruption != "" {
aps["interruption-level"] = a.Interruption
}
if a.ThreadID != "" {
aps["thread-id"] = a.ThreadID
}
Expand Down
1 change: 1 addition & 0 deletions gaurun/apns_http2.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func NewApnsPayloadHttp2(req *RequestGaurunNotification) map[string]interface{}
Sound: req.Sound,
ContentAvailable: req.ContentAvailable,
MutableContent: req.MutableContent,
Interruption: req.Interruption,
}

pm := p.Map()
Expand Down
1 change: 1 addition & 0 deletions gaurun/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type RequestGaurunNotification struct {
MutableContent bool `json:"mutable_content,omitempty"`
Expiry int `json:"expiry,omitempty"`
Retry int `json:"retry,omitempty"`
Interruption string `json:"interruption,omitempty"`
Extend []ExtendJSON `json:"extend,omitempty"`
// meta
ID uint64 `json:"seq_id,omitempty"`
Expand Down