Skip to content

feat(mobile): offer a manual reconnect while the status still reads healthy - #826

Merged
huichen merged 2 commits into
mainfrom
feat/manual-reconnect
Sep 25, 2026
Merged

huichen merged 2 commits into
mainfrom
feat/manual-reconnect

Conversation

@huichen

@huichen huichen commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Why

The 桌面端连接状态 bubble only offered an action once the app had already decided the connection failed. A transport that dies without the client noticing — the socket half-open with the UI still holding the last green presence packet — left the popover saying 已连接 with nothing to act on, and no way back short of unpairing and re-scanning the desktop.

What

  • The bubble now shows the same 重新连接 button in the two states where the app itself still claims things are fine: connected (action: "none") and the attempt still in flight (action: "wait").
  • Pressing it runs the existing reconnect(): the client is torn down and re-opened, and the new socket's onReconnected re-runs the catalogue + timeline recovery the transport-loss path already uses.
  • Rendered as a secondary button (bordered, ink label) so a healthy connection does not push the escape hatch forward; the failure states keep their primary button.
  • States that have their own answer are untouched: 等待桌面端 / 桌面端准备中 (the app is honestly waiting on the desktop) and 配对已失效 (unpair instead).

Verification

  • mobile: npm run typecheck, npm run lint, npx jest --runInBand — 125 suites / 1911 tests pass. The new component test asserts the button's label, its secondary variant, that pressing it calls onReconnect, and that the bubble closes.
  • Screenshot harness: new connection-popover scenario (scripts/screenshots/scenarios.json) opens the bubble by a programmatic click (an emulated tap lands ~58px lower here) and asserts the popover's button labels contain 重新连接 — an empty bubble fails the capture. Captured with the real UI on the Expo web build; OCR of the resulting PNG confirms 桌面端连接状态 / 已连接 / 手机已连接到桌面端 / 重新连接 with the button full width inside the card and nothing clipped.

The captures live in .screenshots/ (gitignored): m-connection-popover.png.

…ealthy

The status popover only carried an action when the app already knew the
connection had failed. A transport that dies without the client noticing —
the socket silently half-open, presence heartbeats missed while the UI keeps
the last green packet — left the user with a badge that said 已连接 and no way
to act on it short of unpairing and re-scanning the desktop.

Give the badge's bubble the same manual reconnect in the two states where the
app itself claims everything is fine (connected, and the attempt still in
flight): the press tears the client down and reconnects, which re-runs the
catalogue and timeline recovery the transport-loss path already uses. It is
rendered as a secondary button so a healthy connection does not push it
forward, and the states that have their own answer (waiting for the desktop
to come up, or a pairing that must be redone) are left alone.

Verified by the existing component tests plus a new `connection-popover`
capture scenario, whose assertion reads the popover's button labels — an empty
bubble now fails the capture instead of shipping quietly.
@huichen
huichen enabled auto-merge (squash) September 25, 2026 09:37
@huichen
huichen merged commit 37d4eb2 into main Sep 25, 2026
12 checks passed
@huichen
huichen deleted the feat/manual-reconnect branch September 25, 2026 09:44
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