-
Notifications
You must be signed in to change notification settings - Fork 59
Add Live Activities Support for iOS Push Notifications #153
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
Changes from 8 commits
20c2faa
12c9e04
a32dc3b
c2e03ea
f3950f7
69d05c2
596b9b0
2bb74a4
bae85ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,13 @@ class ApnMessage | |
| */ | ||
| const PUSH_TYPE_BACKGROUND = 'background'; | ||
|
|
||
| /** | ||
| * The live activity push type. | ||
| * | ||
| * @var string | ||
| */ | ||
| const PUSH_TYPE_LIVE_ACTIVITY = 'liveactivity'; | ||
|
|
||
| /** | ||
| * The title of the notification. | ||
| */ | ||
|
|
@@ -131,6 +138,36 @@ class ApnMessage | |
| */ | ||
| public ?int $mutableContent = null; | ||
|
|
||
| /** | ||
| * The content state for live activities. | ||
| */ | ||
| public ?array $contentState = null; | ||
|
|
||
| /** | ||
| * The event for live activities. | ||
| */ | ||
| public ?string $event = null; | ||
|
|
||
| /** | ||
| * The timestamp for live activities. | ||
| */ | ||
| public ?int $timestamp = null; | ||
|
|
||
| /** | ||
| * The attributes type for live activities. | ||
| */ | ||
| public ?string $attributesType = null; | ||
|
|
||
| /** | ||
| * The attributes for live activities. | ||
| */ | ||
| public array $attributes = []; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern with things like this (and perhaps Is there instead a possibility that a Live Activity should be represented by a different class than an |
||
|
|
||
| /** | ||
| * The dismissal date for live activities. | ||
| */ | ||
| public ?int $dismissalDate = null; | ||
|
|
||
| /** | ||
| * Custom alert for Edamov/Pushok. | ||
| * | ||
|
|
@@ -431,4 +468,74 @@ public function mutableContent(?int $value = 1): self | |
|
|
||
| return $this; | ||
| } | ||
|
|
||
| /** | ||
| * Set content state for live activities. | ||
| */ | ||
| public function contentState(?array $contentState): self | ||
| { | ||
| $this->contentState = $contentState; | ||
|
|
||
| return $this; | ||
| } | ||
|
|
||
| /** | ||
| * Set event for live activities. | ||
| */ | ||
| public function event(?string $event): self | ||
| { | ||
| $this->event = $event; | ||
|
|
||
| return $this; | ||
| } | ||
|
|
||
| /** | ||
| * Set timestamp for live activities. | ||
| */ | ||
| public function timestamp(?int $timestamp): self | ||
| { | ||
| $this->timestamp = $timestamp; | ||
|
|
||
| return $this; | ||
| } | ||
|
|
||
| /** | ||
| * Set attributes type for live activities. | ||
| */ | ||
| public function attributesType(?string $attributesType): self | ||
| { | ||
| $this->attributesType = $attributesType; | ||
|
|
||
| return $this; | ||
| } | ||
|
|
||
| /** | ||
| * Add an attribute for live activities. | ||
| */ | ||
| public function attribute(string $key, mixed $value): self | ||
| { | ||
| $this->attributes[$key] = $value; | ||
|
|
||
| return $this; | ||
| } | ||
|
|
||
| /** | ||
| * Set attributes for live activities. | ||
| */ | ||
| public function setAttributes(array $attributes): self | ||
| { | ||
| $this->attributes = $attributes; | ||
|
|
||
| return $this; | ||
| } | ||
|
|
||
| /** | ||
| * Set dismissal date for live activities. | ||
| */ | ||
| public function dismissalDate(?int $dismissalDate): self | ||
| { | ||
| $this->dismissalDate = $dismissalDate; | ||
|
|
||
| return $this; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive me, as I'm a little out of touch with where APNS is at these days. How many options for push type are there? Looks like internally we have
null,backgroundandvoipsupported.I wonder if these should be moved into an enum like some of the other ones in the package - ApnMessageType.
Is a
liveactivityeffectively abackgroundtype as well?