feat(mobile): mobile app navigation rework and beta-feedback closeout (#2561)

Navigation model rebuilt around two full-width drawers and a minimal
header (sessions / title-switcher / usage ring / workspace):

- Left sessions drawer: cross-project tree with live status indicators,
  swipe actions on sessions (rename/archive/delete) and on group headers
  (project edit / two-step close, worktree delete), reorder-only edit
  mode with collapsible project cards and draggable worktrees, app-level
  footer (connected instance, settings, pending web update).
- Right workspace drawer: Changes / Files / Terminal / Notes / MCP as
  pill tabs (inactive tabs icon-only); panes stay mounted once visited.
  The full desktop file editor serves the Files tab; read/skill tool taps
  in chat open the file there at the requested line.
- Header session switcher on title tap: 10 cross-project recents with
  live busy/attention indicators and project · branch metadata; the
  usage ring opens a metadata overlay with an explicit loading state.
- The overflow menu is gone on phones (its destinations moved into the
  drawers); iPad keeps it until its dedicated layout pass.

Correctness and continuity:

- /auth/session answers bearer-first, so a stale WebView cookie can no
  longer mask a revoked device token; cold launches classify failures
  fast and land on an explicit connect screen.
- Authoritative session snapshots raise frozen ordering baselines and
  stale live ranks — recents stay truthful after the app slept.
- Cold launches reopen the last active session per instance (persisted
  pointer, confirmed against a sessions snapshot; a user-opened draft
  clears it), with a logo hold instead of a draft flash.

Also: collapsed pill composer gains the stop control; chat tool rows
share one 36px rhythm; Task subtool rows truncate; larger bottom safe
area so the composer clears big-screen corner radii; Capacitor build
hides About/Update (store updates apply there); widgets link to the
sessions drawer with a list icon; MobileApp split into focused modules;
five mobile-surface detectors unified; translucent borders normalized to
70%; all new strings translated across the 10 locales.

iPad and foldable layouts are intentionally untouched - separate next version PR.
This commit is contained in:
Bohdan Triapitsyn
2026-08-01 21:16:36 +03:00
committed by GitHub
parent ea8cc5d7b0
commit 86ef96302d
69 changed files with 5006 additions and 4291 deletions
+38 -12
View File
@@ -844,7 +844,12 @@ const probeConnectionCandidates = async (
continue;
}
}
const session = await requestWithTimeout(`${url}/auth/session`, { method: 'GET', credentials: 'include', headers }, requestOptions);
// With a bearer token, probe EXACTLY the way the runtime authenticates:
// bearer-only, no cookies. A leftover valid oc_ui_session cookie in the
// WebView otherwise answers "authenticated" for a revoked/expired token,
// the probe passes, and the app dies later on bootstrap's bearer-only
// requests. Cookie auth stays for the token-less (browser) flow.
const session = await requestWithTimeout(`${url}/auth/session`, { method: 'GET', credentials: token ? 'omit' : 'include', headers }, requestOptions);
if (session?.status === 401) return { status: 'needs-login' };
if (!session || (!session.ok && session.status !== 404)) continue;
const status = await readSessionStatus(session);
@@ -976,28 +981,45 @@ export const getAutoConnectTargetLabel = (): string | null => {
// the runtime endpoint when reachable AND we already have a usable bearer token;
// returns false — caller shows the connect screen — when there is no saved
// instance, it's unreachable, or it needs a (re)login. No prompts or UI state.
export const autoConnectLastInstance = async (): Promise<boolean> => {
export type AutoConnectOutcome =
| { status: 'connected' }
/** No saved instance / no saved token — nothing to report to the user. */
| { status: 'no-candidate' }
| { status: 'unreachable'; label: string }
/** The saved token was rejected (expired/revoked) — the user must sign in again. */
| { status: 'needs-login'; label: string };
export const autoConnectLastInstance = async (): Promise<AutoConnectOutcome> => {
await migrateLegacyInlineTokens();
const candidate = readConnections()[0]; // sorted most-recent-first
if (!candidate) return false;
if (!candidate) return { status: 'no-candidate' };
// The runtime transport needs a bearer token; only auto-connect when one is
// already saved. A missing/expired token must go through the login UI.
let token: string | undefined;
if (isCapacitorApp()) {
if (!candidate.hasToken) return false;
if (!candidate.hasToken) {
return { status: 'no-candidate' };
}
token = await readSecureToken(secureTokenKeyOf(candidate));
if (!token) return false;
if (!token) {
return { status: 'no-candidate' };
}
} else {
token = candidate.clientToken;
if (!token) return false;
if (!token) return { status: 'no-candidate' };
}
const result = await probeConnectionCandidates(candidate.candidates, token);
if (result.status !== 'ok') return false;
// Fast probe: the cold-launch splash should decide in a couple of seconds,
// not sit through the full connect timeouts on a dead LAN candidate. A slow
// network that fails the fast probe still lands on the connect screen where
// a manual tap retries with the full budget.
const result = await probeConnectionCandidates(candidate.candidates, token, { fast: true });
if (result.status === 'needs-login') return { status: 'needs-login', label: candidate.label };
if (result.status !== 'ok') return { status: 'unreachable', label: candidate.label };
await upsertMobileConnection({ id: candidate.id, label: candidate.label, candidates: candidate.candidates }); // bump lastUsedAt (keeps token)
switchToTransport(result.transport, token, { runtimeKey: secureTokenKeyOf(candidate) });
return true;
return { status: 'connected' };
};
export const validateMobileConnectionSession = async (input: {
@@ -1019,7 +1041,9 @@ export const validateMobileConnectionSession = async (input: {
const health = await requestWithTimeout(`${url}/health`, { method: 'GET', headers }, requestOptions);
if (!health?.ok) return false;
const session = await requestWithTimeout(`${url}/auth/session`, { method: 'GET', credentials: 'include', headers }, requestOptions);
// Bearer-only when a token is present — see the probe note about stale
// session cookies masking a revoked token.
const session = await requestWithTimeout(`${url}/auth/session`, { method: 'GET', credentials: token ? 'omit' : 'include', headers }, requestOptions);
if (!session || (!session.ok && session.status !== 404)) return false;
const status = await readSessionStatus(session);
@@ -1129,7 +1153,7 @@ export const isActiveRuntimeConnection = (connection: MobileSavedConnection): bo
return Boolean(runtimeKey) && secureTokenKeyOf(connection) === runtimeKey;
};
export type ReprobeOutcome = 'switched' | 'unchanged' | 'unreachable' | 'no-connection';
export type ReprobeOutcome = 'switched' | 'unchanged' | 'unreachable' | 'needs-login' | 'no-connection';
// App-resume re-probe: when the app wakes (Capacitor `isActive`), the network may
// have changed while it slept, so re-select the active device's transport and
@@ -1163,7 +1187,8 @@ export const reprobeActiveConnection = async (): Promise<ReprobeOutcome> => {
switchToTransport(better.transport, token, { runtimeKey: secureTokenKeyOf(active) });
return 'switched';
}
if (better.status === 'needs-login') return 'unreachable';
// The shared token was explicitly rejected — no transport will accept it.
if (better.status === 'needs-login') return 'needs-login';
// 2. No better transport — is the current one still alive on its live channel?
if (currentIndex >= 0) {
@@ -1186,6 +1211,7 @@ export const reprobeActiveConnection = async (): Promise<ReprobeOutcome> => {
switchToTransport(fallback.transport, token, { runtimeKey: secureTokenKeyOf(active) });
return 'switched';
}
if (fallback.status === 'needs-login') return 'needs-login';
return 'unreachable';
};