Launch Activity Logic
Nucleic-Session: EBB24271-3AB2-4CBD-A47A-59FC73500371 Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
@@ -298,7 +298,12 @@ async function pushLiveActivity(request: Request, env: Env): Promise<Response> {
|
||||
// The push body's topic wins (freshest, from this phone's hello), then the stored record, then
|
||||
// the worker's configured fallback. `sendLiveActivityApns` appends `.push-type.liveactivity`.
|
||||
const topic = body.topic ?? rec.topic ?? cfg.topic;
|
||||
const payload = liveActivityPayload(body.event ?? "update", body.contentState ?? null);
|
||||
// A push-to-start carries the static attributes + their type name; update/end don't.
|
||||
const start =
|
||||
body.event === "start" && body.attributesType
|
||||
? { type: body.attributesType, attributes: body.attributes ?? {} }
|
||||
: null;
|
||||
const payload = liveActivityPayload(body.event ?? "update", body.contentState ?? null, Date.now(), start);
|
||||
const result = await sendLiveActivityApns({ ...cfg, env: apsEnv, topic }, body.token, payload);
|
||||
logPush("liveActivity", body.deviceId, `${topic}.push-type.liveactivity`, apsEnv, result);
|
||||
return json(result, result.status === 200 ? 200 : 502);
|
||||
|
||||
Reference in New Issue
Block a user