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

Add Live Activity type to EPushType #214

Closed
Closed
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 @@ -322,6 +322,17 @@ func TestPushTypeMDMHeader(t *testing.T) {
assert.NoError(t, err)
}

func TestPushTypeLiveActivityHeader(t *testing.T) {
n := mockNotification()
n.PushType = apns.PushTypeLiveActivity
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, "liveactivity", 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
8 changes: 8 additions & 0 deletions notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ const (
// contact the MDM server. If you set this push type, you must use the topic
// from the UID attribute in the subject of your MDM push certificate.
PushTypeMDM EPushType = "mdm"

// PushTypeLiveActivity is used for Live Activities that display various
// real-time information. If you set this push type, the topic field must
// use your app’s bundle ID with push-type.liveactivity appended to the end.
// The live activity push supports only token-based authentication. This
// push type is recommended for iOS. It is not available on macOS, tvOS,
// watchOS and iPadOS.
PushTypeLiveActivity EPushType = "liveactivity"
)

const (
Expand Down