Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pushtotalk type push notification #235

Merged
merged 2 commits into from
Oct 24, 2024
Merged
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
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
Loading