Repository navigation
feat(stream): nav row and resume - #9
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Cyro292
left a comment
There was a problem hiding this comment.
Reviewed against what the mobilerun-mcp device viewer needs, so it can use DeviceStream as is.
Works: built-in Back / Home / Recent row with the right keys, labels for the button names, hideNavigation, and the connection pill only showing while disconnected. Tests pass locally (658 pass, 28 skip, 0 fail) and so does typecheck.
High: the nav row isn't attached to the phone. See the inline comment on device-stream.tsx. Measured with this build (synthetic 360x800 video): row 800px vs phone 238px at 800x600, 1400 vs 283 at 1400x700, 320 vs 131 at 320x364. On wide screens Back / Home / Recent spread across the whole width.
High: a stale resume action can wake the wrong device. use-device-stream.ts:135-146: the callback identity changes per target, but even an old callback reads the latest handleRef.current. A caller that keeps phone A's action across a device switch resumes phone B. Bind the call to the handle it was created for, or reject stale actions.
Medium: the keys can be enabled while clicks are dropped. device-stream.tsx:238-240 checks the peer connection and hasControl, not the control data channel. remote-control.tsx:298-305 drops the key if the channel isn't open.
Medium: "Starting" can get stuck. device-stopped.tsx:31-40 clears the pending state only on rejection. If the confirming refresh after a successful resume fails, or polling is off, the state stays stopped with no Play button and no retry.
Medium: stopping doesn't report a disconnect. device-stream.tsx:211-222 clears local state but never calls onConnectionStateChange(false). External controls driven by that callback stay enabled.
Tests: nothing covers fitted row geometry, a stop then resume with a reconnect, or a connected peer with a closed control channel. device-stream-reconnect.test.tsx:23-42 renders static states only.
Nit: navigation-bar.tsx:10-13 duplicates the SystemButton type from remote-control.tsx:104-110.
| className, | ||
| )} | ||
| > | ||
| <div className="relative flex min-h-0 w-full flex-1 items-center justify-center">{renderScreen()}</div> |
There was a problem hiding this comment.
High: the nav row takes the container's width, not the phone's. The row is a full-width sibling under the flex-1 screen area. The video is letterboxed inside that area (styles.css:120-126, object-fit: contain), so the row never learns the phone's width. At 800x600 the row is 800px wide and the phone 238px. When the video is shorter than the screen area, a gap also opens between the phone and the row.
Suggested fix: wrap the video and the row in one centered box sized to the fitted phone picture, reserve the 36px row height before fitting the video, and keep the row non-shrinking. Please add a test for the fitted geometry.
Cyro292
left a comment
There was a problem hiding this comment.
Requesting changes for the findings in #9 (review). Blocking: the nav row must fit the phone, not the container, and a stale resume action must not wake the wrong device.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
To ship:
If the tag doesn't match |
|
Thanks for the review. All points are fixed in 98634ea and b073a80:
Each point has a test. With this, the viewer in mobilerun-mcp#61 can use the built-in row and drop its own sizing code. |
Summary
DeviceStreamnow ships the phone controls that Mobilerun Cloud shows: a dark Back / Home / Recent apps row inside the screen, and a stopped-device view with a Play button that resumes the device. Both parts are on by default and can be turned off per component.Changes
DeviceStreamrendersNavigationBarunder the video, inside the screen. Keys send BACK / HOME / RECENT and are disabled while the stream is not connected orhasControlis false.hideNavigationturns the row off.NavigationBarkeeps its props and gains optionaldisabledandlabels; its look changes to the dark Cloud row.deviceStateandonResume. WithdeviceState="stopped"the stream is not opened; the screen shows a "Device stopped" pill with a power icon and a round Play button. A tap callsonResumeand shows "Starting" until the state leavesstopped; ifonResumerejects, the button comes back.hideResumeButtonkeeps the pill and hides the button. Reconnecting is paused while the device is stopped and starts fresh when it runs again.useDeviceStream({ device })returnsresume()when the SDK device object supports it (@mobilerun/sdk6.2+). It resumes, then refetches the device, also when the readiness wait fails after the resume request.back,home,recentApps,resume,stopped,starting. Existing complete label objects still type-check.StreamStatusPillgains an optionalicon(spinnerby default, orpower).POST /api/v1/devices/:id/resumeand the read-onlyGET /api/v1/devices/:id/wait, with the same same-origin, id and missing-key guards as the stream-key route. The API key stays on the server.docs/default-ui.mdand the device-stream skill document the new props, flags and labels.Upgrade notes: no version, peer range or export changes. The navigation row now appears by default and takes space inside the component's height; apps that already render their own row should remove it or set
hideNavigation. The navigation buttons aretype="button", so aDeviceStreaminside a form never submits it.Testing
bun run typecheck: passbun test: pass (0 failures)bun run build: pass; the new utility classes are present indist/styles.csshideNavigation, the stopped view (pill, Play, Starting, rejection, state change),hideResumeButton, reconnect paused while stopped,resume()refetch after a failed readiness wait, the old label shape, and the example's resume and wait routes (happy path, invalid id, foreign origin, missing key, upstream errors).Runtime
UNVERIFIED — no resume against a real device yet; needs one stopped dev device resumed through the example app after merge.
Release Checklist
🤖 Generated with Claude Code