Skip to content

Commit 8c41117

Browse files
Fix n.Expiration.IsZero and support pushtotalk push notification (#235)
1 parent b1e286b commit 8c41117

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

client_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,17 @@ func TestPushTypeLiveActivityHeader(t *testing.T) {
352352
assert.NoError(t, err)
353353
}
354354

355+
func TestPushTypePushToTalkHeader(t *testing.T) {
356+
n := mockNotification()
357+
n.PushType = apns.PushTypePushToTalk
358+
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
359+
assert.Equal(t, "pushtotalk", r.Header.Get("apns-push-type"))
360+
}))
361+
defer server.Close()
362+
_, err := mockClient(server.URL).Push(n)
363+
assert.NoError(t, err)
364+
}
365+
355366
func TestAuthorizationHeader(t *testing.T) {
356367
n := mockNotification()
357368
token := mockToken()

notification.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ const (
7171
// push type is recommended for iOS. It is not available on macOS, tvOS,
7272
// watchOS and iPadOS.
7373
PushTypeLiveActivity EPushType = "liveactivity"
74+
75+
// PushTypePushToTalk is used for notifications that provide information about the
76+
// push to talk. If you set this push type, the apns-topic header field
77+
// must use your app’s bundle ID with.voip-ptt appended to the end.
78+
// The pushtotalk push type isn’t available on watchOS, macOS, and tvOS. It’s recommended on iOS and iPadOS.
79+
PushTypePushToTalk EPushType = "pushtotalk"
7480
)
7581

7682
const (

0 commit comments

Comments
 (0)