Skip to content

Commit

Permalink
Fix n.Expiration.IsZero and support pushtotalk push notification (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
deltapath-eric authored Oct 24, 2024
1 parent b1e286b commit 8c41117
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,17 @@ func TestPushTypeLiveActivityHeader(t *testing.T) {
assert.NoError(t, err)
}

func TestPushTypePushToTalkHeader(t *testing.T) {
n := mockNotification()
n.PushType = apns.PushTypePushToTalk
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, "pushtotalk", r.Header.Get("apns-push-type"))
}))
defer server.Close()
_, err := mockClient(server.URL).Push(n)
assert.NoError(t, err)
}

func TestAuthorizationHeader(t *testing.T) {
n := mockNotification()
token := mockToken()
Expand Down
6 changes: 6 additions & 0 deletions notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ const (
// push type is recommended for iOS. It is not available on macOS, tvOS,
// watchOS and iPadOS.
PushTypeLiveActivity EPushType = "liveactivity"

// PushTypePushToTalk is used for notifications that provide information about the
// push to talk. If you set this push type, the apns-topic header field
// must use your app’s bundle ID with.voip-ptt appended to the end.
// The pushtotalk push type isn’t available on watchOS, macOS, and tvOS. It’s recommended on iOS and iPadOS.
PushTypePushToTalk EPushType = "pushtotalk"
)

const (
Expand Down

0 comments on commit 8c41117

Please sign in to comment.