feat: P2 push client — register device + route approval notifications - #7
Merged
Conversation
Slice 2 of push: codeoid-mobile now registers for and routes the daemon's
content-blind approval pushes. Pairs with the daemon backbone (codeoid
#249, merged); consumes push.* via a local wire shim until that ships in a
published @codeoid/protocol release.
- Declares the `push` capability; on a connect where the daemon advertises
it (i.e. a push transport is configured), requests notification
permission, fetches this device's Expo push token, and sends
push.register { token, platform }. Fire-and-forget — a registration
failure never fails the connection. Unregisters on sign-out.
- Tapping a push opens its session (the P2 approval bar shows what's
pending): warm taps navigate immediately; a cold-launch tap is stashed
and opened once the sessions screen is connected. Foreground pushes still
show a banner (approvals are time-sensitive).
- src/lib/push-protocol.ts: local mirror of push.register / push.unregister
+ the "push" capability, cast at one send boundary. Delete and import
from @codeoid/protocol once the release ships — the shapes are identical
by construction and the daemon already validates them.
- Deps (Expo SDK 57 bundled): expo-notifications@~57.0.3,
expo-device@~57.0.0. app.json gains the expo-notifications plugin; new
eas.json (development / preview / production profiles).
Note: remote push tokens require a dev/standalone build — getExpoPushToken
throws in Expo Go for a custom bundle id — so push lights up under
`eas build --profile development`, not Expo Go. The client degrades
gracefully (logs + skips) everywhere else, and no-ops on web.
Verified: tsc + eslint clean; expo export (web) bundles 1018 modules
(expo-notifications / expo-device import cleanly). Device e2e (real push
delivery + tap) needs the dev build plus a daemon with push configured.
Signed-off-by: Yash Datta <saucam@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
KunalJavelin
approved these changes
Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Push notifications — the mobile client (P2 push, slice 2 of 3). codeoid-mobile now registers for and routes the daemon's content-blind approval pushes. Pairs with the daemon backbone (codeoid #249, merged).
Flow
pushcapability. If the daemon advertises it back onauth.ok(i.e. a push transport is configured), the client requests notification permission, fetches this device's Expo push token, and sendspush.register { token, platform }. Fire-and-forget — a registration failure never fails the connection. Sign-out sendspush.unregister.Release coupling (why the shim)
The daemon's
push.*is merged but not yet in a published@codeoid/protocolrelease, and this app pins the registry version — sosrc/lib/push-protocol.tslocally mirrorspush.register/push.unregister+ the"push"capability, cast at onesendboundary. The daemon already validates these exact shapes. Once the release ships, delete that file and import from@codeoid/protocol— the shapes are identical by construction. (This app's@codeoid/protocolpin also needs bumping to the release then; it's currently stale.)Deps + build
expo-notifications@~57.0.3,expo-device@~57.0.0.app.jsongains theexpo-notificationsplugin; neweas.json(development / preview / production).getExpoPushTokenAsyncthrows in Expo Go for a custom bundle id — so push lights up undereas build --profile development, not Expo Go. The client degrades gracefully (logs + skips) elsewhere and no-ops on web.Verification
tsc+eslintclean;expo export --platform webbundles 1018 modules (notification deps import cleanly).push.transport: expoconfigured — the one step that can't run headlessly.Follow-ups
@codeoid/protocol.🤖 Generated with Claude Code