feat(server): name the event in a push and offer a booking as a Google Wallet pass

The push payload carries the event it reports, so the Android app can file a
notification under a channel of its own (chat, trip updates, invitations).
A browser and the iOS extension ignore the field.

GET /api/trips/:tripId/reservations/:id/wallet-pass/google sends the same
request the Apple Wallet signer takes to the TREK services' Google route and
answers with the signed save-to-wallet link the Android app opens. Off with the
other TREK services, and a clear 404 while liketrek has no Wallet issuer yet.
This commit is contained in:
Maurice
2026-11-07 14:11:22 +01:00
parent 41c713fd9a
commit d41a4f0827
9 changed files with 151 additions and 2 deletions
@@ -85,6 +85,7 @@ function payloadBytes(payload: PushPayload): number {
* chat messages carry a tag, `collab_message:<trip path>`, so a burst of them in
* one trip shows as one notification that keeps updating instead of a pile of
* them. Everything else has no tag and never replaces an earlier notification.
* The event goes along so the Android app can sort it into a channel.
*
* The body is cut, at a character boundary and with an ellipsis, until the
* JSON fits MAX_PUSH_PAYLOAD_BYTES. The title and the path are capped first, so
@@ -99,6 +100,8 @@ export function buildPushPayload(
body: '',
...(url ? { url } : {}),
...(url && msg.event === COLLAPSING_EVENT ? { tag: `${COLLAPSING_EVENT}:${url}` } : {}),
// The Android app files it under a channel by event; a browser ignores it.
...(msg.event ? { event: msg.event } : {}),
};
const full = { ...base, body: msg.body };
if (payloadBytes(full) <= MAX_PUSH_PAYLOAD_BYTES) return full;