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 support for starting a Live Activity with input-push-token on iOS 18 #1079

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ifrins
Copy link
Contributor

@ifrins ifrins commented Aug 17, 2024

Adds support for passing the input-push-token attribute, which is required in iOS 18 to start a Live Activity that wakes the app to get a push token to update the created Live Activity (which was not needed on iOS 17).

This has been tested with iOS 18.0 beta 6.

Apple docs: https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications

@ifrins ifrins force-pushed the feature/live-activities-ios18 branch from b3c0583 to 13af288 Compare August 17, 2024 21:13
@ifrins ifrins changed the title Add support for starting Live Activity from a push notification Add support for starting a Live Activity with input-push-token on iOS 18 Aug 17, 2024
Copy link
Owner

@jchambers jchambers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for the contribution! It's unclear to me why Apple has decided to model this as an integer; it seems like it's a boolean flag, right?

I think it probably makes sense to change the internal representation from a nullable Integer to just a boolean, then turn that into a 1 when we actually build the payload. Does that seem reasonable to you?

@@ -856,6 +858,19 @@ public ApnsPayloadBuilder setTimestamp(final Instant timestamp) {
return this;
}

/**
* <p>Sets the flag to wake up the app and receive a push token to send updates to the started Live Activity.</p>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple comments here:

  1. If this is a single paragraph, I don't think we need <p> tags.
  2. While this isn't incorrect, I do think there's more of the story we can and should tell for callers. In particular: this is for establishing a new channel for live activities, and it's intended for iOS 18 and newer. If it's helpful to you, I'd be happy to suggest specific wording!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay! I have updated the Javadoc to provide a bit more info. If the changes are fine, otherwise I'm open for any suggestions. In general, I don't like rehashing info from the source (Apple docs in this case), since from the outside most of the time it feels like trying to documenting undocumented behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants