Repository navigation
Phone push notifications (GRYT-1656) - #307
Merged
Merged
Conversation
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]>
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.
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-notificationsaddsaps-environment.scripts/ios-profiles.mjsnow 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 onlychat.gryt.app.Android: needs
google-services.jsonfrom a Firebase project.app.config.jspicks 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
backgroundas it left and came back. A notification sent withsimctl pushshowed "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, andgetDevicePushTokenAsyncnow 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