Skip to content

Phone push notifications (GRYT-1656) - #307

Merged
sivert-io merged 2 commits into
mainfrom
claude/GRYT-1656-push
Oct 7, 2026
Merged

sivert-io merged 2 commits into
mainfrom
claude/GRYT-1656-push

Conversation

@sivert-io

Copy link
Copy Markdown
Member

Phone push notifications (GRYT-1656)

The phone asks for notification permission the first time it connects to a server. It then gets a device token, asks the relay for a capability for each server and hands it over. A server set to "None" in notification settings, or everything set to "None", gets its capability taken back on both the server and the relay.

The app tells each server when it goes to the background. The server only pushes when you're not at a screen. Tapping a notification opens the server it came from. The relay tags each notification with the first 16 hex of the capability's SHA-256, and the phone matches that against the capabilities it holds.

iOS: expo-notifications adds aps-environment. scripts/ios-profiles.mjs now turns on Push for the App ID and rebuilds the App Store profile if it doesn't carry it. A dry run against App Store Connect says it would rebuild only chat.gryt.app.

Android: needs google-services.json from a Firebase project. app.config.js picks it up when the file is there. Without it the build works and pushes are just off.

Checked on the simulator against a local server and relay. The permission prompt showed. The relay and the server both stored the registration, and the app flipped background as it left and came back. A notification sent with simctl push showed "Someone mentioned you", and tapping it from another server opened Pins test. The simulator never got a real token from Apple. That's normal for a simulator, so the last step used a stand-in token, and getDevicePushTokenAsync now gives up after 20 seconds so the next connect can try again. Muting a server, which takes the capability back, isn't tried on a device yet. tsc is clean and 1,405 tests pass.

Needs the server half (Gryt-chat/server#283) and the relay (Gryt-chat/push) live before anything arrives.

🤖 Generated with Claude Code

sivert-io and others added 2 commits October 7, 2026 13:08
The phone asks for notification permission the first time it connects to a server. It then gets a device token, asks the relay for a capability for each server and hands it over. A server set to "None" in notification settings, or everything set to "None", gets its capability taken back on both the server and the relay.

The app tells each server when it goes to the background. The server only pushes when you're not at a screen. Tapping a notification opens the server it came from. The relay tags each notification with the first 16 hex of the capability's SHA-256, and the phone matches that against the capabilities it holds.

iOS: `expo-notifications` adds `aps-environment`. `scripts/ios-profiles.mjs` now turns on Push for the App ID and rebuilds the App Store profile if it doesn't carry it. A dry run against App Store Connect says it would rebuild only `chat.gryt.app`.

Android: needs `google-services.json` from a Firebase project. `app.config.js` picks it up when the file is there. Without it the build works and pushes are just off.

Checked on the simulator against a local server and relay. The permission prompt showed. The relay and the server both stored the registration, and the app flipped `background` as it left and came back. A notification sent with `simctl push` showed "Someone mentioned you", and tapping it from another server opened Pins test. The simulator never got a real token from Apple. That's normal for a simulator, so the last step used a stand-in token, and `getDevicePushTokenAsync` now gives up after 20 seconds so the next connect can try again. Muting a server, which takes the capability back, isn't tried on a device yet. tsc is clean and 1,405 tests pass.

Needs the server half (Gryt-chat/server#xxx) and the relay (Gryt-chat/push) live before anything arrives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
google-services.json is from the Gryt Firebase project (gryt-feab7, on
[email protected]). It isn't secret: it ships inside every APK,
and app.config.js picks it up for the build. The relay's service account
key is separate and stays off git.

expo-notifications pulled in its own expo-constants and
expo-application, which expo-doctor refuses. Deduplicated in the lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sivert-io
sivert-io merged commit 8c35b6c into main Oct 7, 2026
5 checks passed
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.

1 participant