Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(mobile): 覆盖 Duo 抽屉头部顶部位置计算
Dash365f7764b445
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsxindex 28c4a74a3a..7942b546de 100644--- a/apps/mobile/app/sessions/[sessionId].tsx+++ b/apps/mobile/app/sessions/[sessionId].tsx@@ -18,7 +18,7 @@ import { HomeNewTaskButton } from '@/session/HomeNewTaskButton';import { RecentMessageHistories, MessageHistoryOverlay } from '@/session/RecentMessageHistories';import { rememberRecentTask } from '@/session/recentTasks';import { SystemNavigationBack, useSystemNavigationBack } from '@/platform/chrome/SystemNavigationBack';-import { keyboardControlRegion, type LayoutRect } from '@/platform/windowGeometry';+import { keyboardControlRegion, sharedStatusRowDrawerTop, type LayoutRect } from '@/platform/windowGeometry';import { useAdaptiveWindow, PaneViewportProvider } from '@/platform/AdaptiveWindowContext';import { useSessionHeaderHeight } from '@/session/useSessionHeaderHeight';import { useDoubleTap } from '@/session/useDoubleTap';@@ -3060,11 +3060,9 @@ function SessionScreenContent({ beforeSessionSwitchRef, newSessionActionRef }: Sconst topChromeHeight = Math.max(topOverlayHeight,horizontalSystemHeader ? nativeHeaderHeight : insets.top + navigationChrome.target);// The drawer hides that toolbar; put the drawer's own header in the same row instead of- // below the whole status area. Duo (iOS 27.1) centers toolbar items spacing.md above the- // area's bottom; the drawer header adds spacing.lg itself. Ordinary bars keep safeArea.top.- const sessionListDrawerTopInset = horizontalSystemHeader && nativeHeaderHeight > 0- && nativeHeaderHeight < insets.top + navigationChrome.target- ? Math.max(0, nativeHeaderHeight - navigationChrome.target - spacing.md - spacing.lg) : undefined;+ // below the whole status area.+ const sessionListDrawerTopInset = horizontalSystemHeader+ ? sharedStatusRowDrawerTop(nativeHeaderHeight, insets.top) : undefined;// 退出宽屏后 layout.drawerWidth 会变 0;退场期间继续用最后一个有效宽度,避免面板几何跳变。const sessionListDrawerWidthRef = useRef(wideSessionNav.drawerWidth);if (wideSessionNav.enabled) sessionListDrawerWidthRef.current = wideSessionNav.drawerWidth;diff --git a/apps/mobile/src/__tests__/windowGeometry.test.ts b/apps/mobile/src/__tests__/windowGeometry.test.tsindex bf43cb5eb6..be4d0b6580 100644--- a/apps/mobile/src/__tests__/windowGeometry.test.ts+++ b/apps/mobile/src/__tests__/windowGeometry.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest';-import { keyboardControlRegion, controlRegion, windowDivision, type WindowGeometry } from '@/platform/windowGeometry';+import { keyboardControlRegion, controlRegion, sharedStatusRowDrawerTop, windowDivision, type WindowGeometry } from '@/platform/windowGeometry';import { foldDesktopLayout } from '@/remote-desktop/foldDesktopLayout';import { sessionPaneLayout } from '@/session/sessionPaneLayout';@@ -103,3 +103,14 @@ describe('folded desktop keyboard geometry', () => {expect(foldDesktopLayout(window(), 0, 240, false)).toBeNull();});});++// Regression: #7008. Duo portrait's top bar shares the status row, so the task-list drawer header+// sat 72pt too low under safeArea.top; measured on the Duo simulator (safe top 82, bar height 82).+describe('task-list drawer top when the system bar shares the status row', () => {+ it('lands the header on the shared row for Duo and leaves ordinary bars alone', () => {+ expect(sharedStatusRowDrawerTop(82, 82)).toBe(10);+ expect(sharedStatusRowDrawerTop(40, 82)).toBe(0);+ expect(sharedStatusRowDrawerTop(103, 59)).toBeUndefined();+ expect(sharedStatusRowDrawerTop(0, 82)).toBeUndefined();+ });+});diff --git a/apps/mobile/src/platform/windowGeometry.ts b/apps/mobile/src/platform/windowGeometry.tsindex d2acae7f4e..eb4c81ac8c 100644--- a/apps/mobile/src/platform/windowGeometry.ts+++ b/apps/mobile/src/platform/windowGeometry.ts@@ -1,3 +1,5 @@+import { navigationChrome, spacing } from '@/theme/tokens';+/** Geometry is local to the observed window container, in points, never pixels. */export interface LayoutRect { x: number; y: number; width: number; height: number }export interface ReservedRegion extends LayoutRect { kind: 'division' | 'occlusion' }@@ -72,3 +74,14 @@ export function keyboardControlRegion(g: WindowGeometry, keyboardBottom: number)const alternative = clip(upper);return alternative.height > controls.height ? alternative : controls;}++/**+ * Top padding for the temporary task-list drawer when the native top bar shares the status row+ * (Duo portrait), so the drawer header lands where the hidden bar's buttons were. Duo (iOS 27.1)+ * centers toolbar items `spacing.md` above the row's bottom; the drawer header adds `spacing.lg`+ * itself. Undefined keeps the safe-area top for ordinary bars below the status area.+ */+export function sharedStatusRowDrawerTop(nativeHeaderHeight: number, safeAreaTop: number): number | undefined {+ if (!(nativeHeaderHeight > 0) || nativeHeaderHeight >= safeAreaTop + navigationChrome.target) return undefined;+ return Math.max(0, nativeHeaderHeight - navigationChrome.target - spacing.md - spacing.lg);+}