diff --git a/SPEC.md b/SPEC.md index 0667986..bca0b84 100644 --- a/SPEC.md +++ b/SPEC.md @@ -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": "..." }] }, { @@ -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). diff --git a/buford/payload/aps.go b/buford/payload/aps.go index 5ff4c1e..fffa521 100644 --- a/buford/payload/aps.go +++ b/buford/payload/aps.go @@ -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 } @@ -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 } diff --git a/gaurun/apns_http2.go b/gaurun/apns_http2.go index c60a9d7..84037e8 100644 --- a/gaurun/apns_http2.go +++ b/gaurun/apns_http2.go @@ -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() diff --git a/gaurun/notification.go b/gaurun/notification.go index 72c4eed..2a0f892 100644 --- a/gaurun/notification.go +++ b/gaurun/notification.go @@ -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"`