Closed 4l3ss closed 1 month ago
Could you share how you are setting up the live activities on the native side? You should have something like this: https://github.com/urbanairship/react-native-airship/blob/main/example/ios/AirshipPluginExtender.swift#L20
If that is all setup properly, could you enable verbose logs on the SDK and start one from a push or JS while capturing logs? This is the log that will be most useful if you want to try to filter on it:
AirshipLogger.debug("Live activity update: \(update)")
I was just able to reproduce it, so no need to continue to investigate. If you want to post the setup code you have I can verify that is correct while I fix the bug. I must of only tested starting one from JS and updating it through the api, not start and update through the api 🤦
Oh great thank you, yeah here's the code anyway but it's basically the same as what's in the doc
import Foundation
import AirshipKit
import AirshipFrameworkProxy
import ActivityKit
// This class header is required to be automatically picked up by the Airship plugin:
@objc(AirshipPluginExtender)
public class AirshipPluginExtender: NSObject, AirshipPluginExtenderProtocol {
public static func onAirshipReady() {
if #available(iOS 16.1, *) {
// Will throw if called more than once
try? LiveActivityManager.shared.setup { configurator in
// Call for each Live Activity type
await configurator.register(forType: Activity<OrderTimelineAttributes>.self) { attributes in
// Track this property as the Airship name for updates
attributes.name
}
}
}
}
}
Looks great. I have a fix locally but want to test it out some more since I missed a few test cases last time. Hopefully will have an update by end of my day.
https://github.com/urbanairship/airship-mobile-framework-proxy/pull/64
If you copy the contents of LIveActivityManager.swift from that PR to your local pod file, you can see if that fix works for you
Just tested and can confirm it works, thank you!
I was able to test most things, but now I cant seem to test through the api but getting this error in the console:
default 07:49:42.642061-0700 liveactivitiesd Received push event for com.urbanairship.richpush::pushToStart
default 07:49:42.642158-0700 liveactivitiesd Reduced budget for com.urbanairship.richpush::pushToStart to: -9
default 07:49:42.642193-0700 liveactivitiesd Topic com.urbanairship.richpush.push-type.liveactivity is out of budget because pushToStart is exhausted
default 07:49:42.642762-0700 liveactivitiesd Received pushToStart notification for com.urbanairship.richpush::pushToStart
default 07:49:42.642891-0700 liveactivitiesd Push-to-start budget exceeded for com.urbanairship.richpush::pushToStart; not starting activity
I am not sure if they have that throttling documented, but if things randomly stop working for you take a look at the console
Preliminary Info
What Airship dependencies are you using?
@ua/react-native-airship 19.4.2
What are the versions of any relevant development tools you are using?
react-native 0.74.6
Report
What unexpected behavior are you seeing?
We can't update the state of a live activity through a push notification. It seems to stay stuck in the initial state, which was provided on the initial push with event=start
The creation through a push notification works properly, but updating doesn't seem to have any effect. It only works when using the JS API using
Airship.iOS.liveActivityManager.update
but this isn't what we want to achieve.What is the expected behavior?
We expect the live activity state to be properly updated when sending a push with a different content_state, as specified in the documentation at https://docs.airship.com/platform/mobile/ios-live-activities/?groupid=react-native#updating-live-activities
What are the steps to reproduce the unexpected behavior?
We can successfully start a live activity through a push by sending a POST request to airship api :
Then we try to update the same activity by tergeting it by its name with this payload :
But nothing seems to happen.
Do you have logging for the issue?
no