Skip to content

Commit da12cc5

Browse files
committed
docs(mobile): name the connection switcher wrapper and the connectionRemoved answer
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTVYu9vDSx28X2zi7h
1 parent 4661442 commit da12cc5

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎ui/packages/mobile/README.md‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,23 @@ shell; the bridge contract is owned by the mobile app (`docs/HYBRID-SHELL.md`,
330330
change, and the shell's cancelable `objectstack-native:navigate` window event moves
331331
the router (in-app paths only) instead of reloading the page. Outside the shell it
332332
installs nothing.
333+
- The same hook answers the shell's `objectstack-native:connectionRemoved` window
334+
event (`NATIVE_CONNECTION_REMOVED_EVENT`), sent when the user removes this
335+
connection in the shell: it calls `event.waitUntil()` with the promise its optional
336+
`onConnectionRemoved` returns (unregister the device's push token under the page's
337+
own session), or with one already resolved when the option is omitted.
333338
- `ready()` means "the page has painted its own UI", which may be a loading fallback,
334339
such as an auth guard's spinner while the session is read. The shell lifts its
335340
loading cover on it, so the cover hands over to that spinner instead of staying up
336341
through the session round-trip.
337-
- `nativeGetPushToken`, `nativeHaptic`, `nativeOpenExternal`, `nativeNavigate` and
338-
`nativeResetServer` check `has(capability)` and that the method exists before
339-
calling. They never throw: each resolves `{ status: 'unavailable' }` without the
340-
capability, `{ status: 'ok', value }` on success, or
341-
`{ status: 'failed', code, message }` when the shell refuses the call.
342+
- `nativeGetPushToken`, `nativeHaptic`, `nativeOpenExternal`, `nativeNavigate`,
343+
`nativeResetServer` and `nativeShowConnectionSwitcher` check `has(capability)` and
344+
that the method exists before calling. They never throw: each resolves
345+
`{ status: 'unavailable' }` without the capability, `{ status: 'ok', value }` on
346+
success, or `{ status: 'failed', code, message }` when the shell refuses the call.
347+
- `nativeHostCan(host, method)` is that same check, for a control that picks its
348+
native or web path before it renders (the header's organization button opens the
349+
shell's switcher this way).
342350

343351
```tsx
344352
import { nativeHaptic } from '@object-ui/mobile';

‎ui/packages/mobile/src/useNativeHost.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ export interface UseNativeHostRoutingOptions {
123123
* the shell's own full-load fallback runs;
124124
* - answers the shell's `objectstack-native:connectionRemoved` event: calls
125125
* `event.waitUntil()` with the promise `onConnectionRemoved` returns, or with
126-
* one already resolved when it is omitted. A failed unregister settles the
127-
* promise too; the shell then records the token as left registered.
126+
* one already resolved when it is omitted. An unregister that fails rejects
127+
* that promise, so the shell is never held past the step itself.
128128
*
129129
* Outside the shell it does nothing and installs no listener. Returns the
130130
* bridge, or `null`.

0 commit comments

Comments
 (0)