Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): 横屏返回钮不因灵动岛安全区被推开 (#4594)
Dash8a4af4715fe5
diff --git a/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx b/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsxindex bc1178e94c..2d356d3f54 100644--- a/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx+++ b/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx@@ -2129,10 +2129,13 @@ export default function RemoteDesktopScreen() {top: landscape? insets.top + spacing.lg: edgePadding.paddingTop + spacing.xs,- // Keep the 44pt control out of the island: follow the rail when it- // is on the left, otherwise start after the left safe inset.+ // iOS landscape: Island/notch sits mid-edge, so the top-left+ // corner stays clear even when insets.left is large. Skip that+ // inset unless the top edge is also unsafe — a physical cutout+ // occupying the corner, not a centered island. Android left+ // insets are an unsafe strip (cutout/curve), not an island.left: landscape- ? (toolbarOnLeft ? 0 : insets.left) ++ ? (Platform.OS === "ios" && insets.top === 0 ? 0 : insets.left) +spacing.lg +(Platform.OS === "ios" ? spacing.xs : 0): edgePadding.paddingLeft + spacing.lg,diff --git a/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx b/apps/mobile/src/remote-desktop/__tests__/screen.test.tsxindex 1605acde95..28da7889ee 100644--- a/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx+++ b/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx@@ -1386,7 +1386,7 @@ describe("remote desktop controls", () => {});}});- it("keeps the landscape back button clear of the left safe area", async () => {+ it("keeps the landscape back button in the corner when only the long edge is inset", async () => {fixture.size = { width: 874, height: 402 };fixture.safe = { top: 0, bottom: 21, left: 62, right: 62 };for (const islandRight of [false, true]) {@@ -1407,9 +1407,68 @@ describe("remote desktop controls", () => {.flat(Infinity).filter(Boolean),);- expect(style.left).toBe(islandRight ? 20 : 82);+ expect(style.left).toBe(20);}});+ it("shifts the landscape back button when a cutout occupies the top-left corner", async () => {+ fixture.size = { width: 874, height: 402 };+ fixture.safe = { top: 24, bottom: 21, left: 48, right: 0 };+ act(() => root.render(<RemoteDesktopScreen />));+ act(() =>+ fixture.message!({+ nativeEvent: {+ data: JSON.stringify({ type: "orientation", angle: 90 }),+ },+ }),+ );+ const style = Object.assign(+ {},+ ...fixture.views["remoteDesktop.backPosition"].style+ .flat(Infinity)+ .filter(Boolean),+ );+ expect(style.left).toBe(68);+ });+ it("honors Android landscape left insets even when the top edge is clear", async () => {+ fixture.platform = "android";+ fixture.size = { width: 874, height: 402 };+ fixture.safe = { top: 0, bottom: 21, left: 62, right: 62 };+ act(() => root.render(<RemoteDesktopScreen />));+ act(() =>+ fixture.message!({+ nativeEvent: {+ data: JSON.stringify({ type: "orientation", angle: 90 }),+ },+ }),+ );+ const style = Object.assign(+ {},+ ...fixture.views["remoteDesktop.backPosition"].style+ .flat(Infinity)+ .filter(Boolean),+ );+ expect(style.left).toBe(78);+ });+ it("does not treat Android status-bar plus mid-edge inset as an iOS island", async () => {+ fixture.platform = "android";+ fixture.size = { width: 874, height: 402 };+ fixture.safe = { top: 24, bottom: 21, left: 62, right: 62 };+ act(() => root.render(<RemoteDesktopScreen />));+ act(() =>+ fixture.message!({+ nativeEvent: {+ data: JSON.stringify({ type: "orientation", angle: 90 }),+ },+ }),+ );+ const style = Object.assign(+ {},+ ...fixture.views["remoteDesktop.backPosition"].style+ .flat(Infinity)+ .filter(Boolean),+ );+ expect(style.left).toBe(78);+ });it("restores a centered bottom toolbar after a full rotation without remounting the viewer", async () => {await connect();const viewer = host.querySelector('[data-testid="remoteDesktop.viewer"]');