feat: add apple watch connector#60
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| const iosAddListener: AddListener = (event, cb) => { | ||
| if (!event) { | ||
| throw new Error('Must pass event'); | ||
| } | ||
|
|
||
| let watchEvents: WatchEvents = { | ||
| addListener: _addListenerMock, | ||
| on: _addListenerMock, | ||
| switch (event) { | ||
| case 'message': | ||
| break; | ||
| default: | ||
| throw new Error(`Unknown watch event "${event}"`); | ||
| } | ||
|
|
||
| const sub = appleWatchEvents.addListener(event, cb); |
There was a problem hiding this comment.
[P1] Activate WCSession before registering iOS listeners
The new iOS code registers event listeners directly via appleWatchEvents.addListener but never activates the underlying WatchConnectivity session. Activation currently only happens inside AppleWatchConnector.sendMessage, so an app that starts by listening for incoming watch messages (without sending anything first) will never activate the session and will miss all events. Call appleWatchConnector.activateSession() before subscribing so inbound watch messages are received even when no outbound message is sent.
Useful? React with 👍 / 👎.
Summary
react-native-watch-connectivitydependencyAppleWatchConnectorfor session activation and iOS messagingTesting
yarn lint(fails: ESLint couldn't find the plugin "eslint-plugin-ft-flow")yarn add -D eslint-plugin-ft-flow(fails: tunneling socket could not be established, statusCode=403)yarn test(fails: Cannot find module '@react-native/babel-preset')yarn typecheckhttps://chatgpt.com/codex/tasks/task_e_68b70279fe1c8320be435d92b67297ad