Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): 恢复消息菜单图标并统一跨端规范 (#4133)

Dash7f7c7589edc6
diff --git a/apps/mobile/app.json b/apps/mobile/app.json
index 203308d5b1..c49ad1c834 100644
--- a/apps/mobile/app.json
+++ b/apps/mobile/app.json
@@ -57,6 +57,7 @@
"favicon": "./assets/favicon.png"
},
"plugins": [
+ "./plugins/with-message-menu-icons",
"./plugins/with-third-party-notices",
"./plugins/with-google-signin-modular-headers",
"./plugins/with-wechat-opensdk-modulemap",
diff --git a/apps/mobile/assets/message-menu/LICENSE b/apps/mobile/assets/message-menu/LICENSE
new file mode 100644
index 0000000000..325e8ff0aa
--- /dev/null
+++ b/apps/mobile/assets/message-menu/LICENSE
@@ -0,0 +1,15 @@
+ISC License
+
+Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/apps/mobile/assets/message-menu/README.md b/apps/mobile/assets/message-menu/README.md
new file mode 100644
index 0000000000..a29eea1c17
--- /dev/null
+++ b/apps/mobile/assets/message-menu/README.md
@@ -0,0 +1,28 @@
+# Message menu icons
+
+The SVG artwork is exported directly from the desktop's `lucide-react` 0.468.0
+components at a 24 × 24 viewBox with stroke width 2, round caps and joins.
+The accompanying 1x/2x/3x PNGs are rasterizations of those SVGs; do not redraw them
+or replace them with SF Symbols. Lucide's ISC license is included in `LICENSE`.
+
+The SVG viewBox describes source geometry, not display size. Rasterize at
+18 × 18 pt (`iconSize.lg`), yielding 18 / 36 / 54 px for 1x / 2x / 3x.
+Keep stroke width 2 in the source viewBox (`iconStroke.regular`), scaling it
+with the artwork as Lucide does. This matches the existing mobile message,
+session, and file action sheets; the native menu retains system row spacing.
+
+| Asset | Desktop / React Native glyph |
+| ------------------------- | ---------------------------- |
+| cindy-message-square-plus | MessageSquarePlus |
+| cindy-link-2 | Link2 |
+| cindy-undo-2 | Undo2 |
+| cindy-trash-2 | Trash2 |
+
+`with-message-menu-icons` copies the image sets into the app's existing Xcode
+asset catalog. The native menu loads them with `UIImage(named:)`; the JS wrapper
+applies semantic foreground/destructive colors for Light and Dark.
+
+These are native resources: shipping them requires a new native build. The
+2026-09-08 user decision explicitly retained the system menu and accepted this
+rebuild. Existing installations cannot acquire the assets through an OTA-only
+update. See `docs/design-rules/DESIGN.md` §15.13 for the cross-platform contract.
diff --git a/apps/mobile/assets/message-menu/cindy-link-2.imageset/Contents.json b/apps/mobile/assets/message-menu/cindy-link-2.imageset/Contents.json
new file mode 100644
index 0000000000..431c748e67
--- /dev/null
+++ b/apps/mobile/assets/message-menu/cindy-link-2.imageset/Contents.json
@@ -0,0 +1,26 @@
+{
+ "images": [
+ {
+ "filename": "cindy-link-2.png",
+ "idiom": "universal",
+ "scale": "1x"
+ },
+ {
+ "filename": "[email protected]",
+ "idiom": "universal",
+ "scale": "2x"
+ },
+ {
+ "filename": "[email protected]",
+ "idiom": "universal",
+ "scale": "3x"
+ }
+ ],
+ "info": {
+ "author": "xcode",
+ "version": 1
+ },
+ "properties": {
+ "template-rendering-intent": "template"
+ }
+}
diff --git a/apps/mobile/assets/message-menu/cindy-link-2.imageset/cindy-link-2.png b/apps/mobile/assets/message-menu/cindy-link-2.imageset/cindy-link-2.png
new file mode 100644
index 0000000000..a79df8f69f
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-link-2.imageset/cindy-link-2.png differ
diff --git a/apps/mobile/assets/message-menu/cindy-link-2.imageset/[email protected] b/apps/mobile/assets/message-menu/cindy-link-2.imageset/[email protected]
new file mode 100644
index 0000000000..b3385df327
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-link-2.imageset/[email protected] differ
diff --git a/apps/mobile/assets/message-menu/cindy-link-2.imageset/[email protected] b/apps/mobile/assets/message-menu/cindy-link-2.imageset/[email protected]
new file mode 100644
index 0000000000..da77e3f9be
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-link-2.imageset/[email protected] differ
diff --git a/apps/mobile/assets/message-menu/cindy-link-2.svg b/apps/mobile/assets/message-menu/cindy-link-2.svg
new file mode 100644
index 0000000000..66176933af
--- /dev/null
+++ b/apps/mobile/assets/message-menu/cindy-link-2.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-link2"><path d="M9 17H7A5 5 0 0 1 7 7h2"></path><path d="M15 7h2a5 5 0 1 1 0 10h-2"></path><line x1="8" x2="16" y1="12" y2="12"></line></svg>
diff --git a/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/Contents.json b/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/Contents.json
new file mode 100644
index 0000000000..a84e1c7d08
--- /dev/null
+++ b/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/Contents.json
@@ -0,0 +1,26 @@
+{
+ "images": [
+ {
+ "filename": "cindy-message-square-plus.png",
+ "idiom": "universal",
+ "scale": "1x"
+ },
+ {
+ "filename": "[email protected]",
+ "idiom": "universal",
+ "scale": "2x"
+ },
+ {
+ "filename": "[email protected]",
+ "idiom": "universal",
+ "scale": "3x"
+ }
+ ],
+ "info": {
+ "author": "xcode",
+ "version": 1
+ },
+ "properties": {
+ "template-rendering-intent": "template"
+ }
+}
diff --git a/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/cindy-message-square-plus.png b/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/cindy-message-square-plus.png
new file mode 100644
index 0000000000..777c5867be
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/cindy-message-square-plus.png differ
diff --git a/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/[email protected] b/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/[email protected]
new file mode 100644
index 0000000000..8e64cfda00
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/[email protected] differ
diff --git a/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/[email protected] b/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/[email protected]
new file mode 100644
index 0000000000..cbefffeb55
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-message-square-plus.imageset/[email protected] differ
diff --git a/apps/mobile/assets/message-menu/cindy-message-square-plus.svg b/apps/mobile/assets/message-menu/cindy-message-square-plus.svg
new file mode 100644
index 0000000000..9b5f781383
--- /dev/null
+++ b/apps/mobile/assets/message-menu/cindy-message-square-plus.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-square-plus"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path><path d="M12 7v6"></path><path d="M9 10h6"></path></svg>
diff --git a/apps/mobile/assets/message-menu/cindy-trash-2.imageset/Contents.json b/apps/mobile/assets/message-menu/cindy-trash-2.imageset/Contents.json
new file mode 100644
index 0000000000..c0b88faf76
--- /dev/null
+++ b/apps/mobile/assets/message-menu/cindy-trash-2.imageset/Contents.json
@@ -0,0 +1,26 @@
+{
+ "images": [
+ {
+ "filename": "cindy-trash-2.png",
+ "idiom": "universal",
+ "scale": "1x"
+ },
+ {
+ "filename": "[email protected]",
+ "idiom": "universal",
+ "scale": "2x"
+ },
+ {
+ "filename": "[email protected]",
+ "idiom": "universal",
+ "scale": "3x"
+ }
+ ],
+ "info": {
+ "author": "xcode",
+ "version": 1
+ },
+ "properties": {
+ "template-rendering-intent": "template"
+ }
+}
diff --git a/apps/mobile/assets/message-menu/cindy-trash-2.imageset/cindy-trash-2.png b/apps/mobile/assets/message-menu/cindy-trash-2.imageset/cindy-trash-2.png
new file mode 100644
index 0000000000..b03dd9f040
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-trash-2.imageset/cindy-trash-2.png differ
diff --git a/apps/mobile/assets/message-menu/cindy-trash-2.imageset/[email protected] b/apps/mobile/assets/message-menu/cindy-trash-2.imageset/[email protected]
new file mode 100644
index 0000000000..9d832f2b13
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-trash-2.imageset/[email protected] differ
diff --git a/apps/mobile/assets/message-menu/cindy-trash-2.imageset/[email protected] b/apps/mobile/assets/message-menu/cindy-trash-2.imageset/[email protected]
new file mode 100644
index 0000000000..e185d0416e
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-trash-2.imageset/[email protected] differ
diff --git a/apps/mobile/assets/message-menu/cindy-trash-2.svg b/apps/mobile/assets/message-menu/cindy-trash-2.svg
new file mode 100644
index 0000000000..ed937c83e3
--- /dev/null
+++ b/apps/mobile/assets/message-menu/cindy-trash-2.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash2"><path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line></svg>
diff --git a/apps/mobile/assets/message-menu/cindy-undo-2.imageset/Contents.json b/apps/mobile/assets/message-menu/cindy-undo-2.imageset/Contents.json
new file mode 100644
index 0000000000..b9f42d890d
--- /dev/null
+++ b/apps/mobile/assets/message-menu/cindy-undo-2.imageset/Contents.json
@@ -0,0 +1,26 @@
+{
+ "images": [
+ {
+ "filename": "cindy-undo-2.png",
+ "idiom": "universal",
+ "scale": "1x"
+ },
+ {
+ "filename": "[email protected]",
+ "idiom": "universal",
+ "scale": "2x"
+ },
+ {
+ "filename": "[email protected]",
+ "idiom": "universal",
+ "scale": "3x"
+ }
+ ],
+ "info": {
+ "author": "xcode",
+ "version": 1
+ },
+ "properties": {
+ "template-rendering-intent": "template"
+ }
+}
diff --git a/apps/mobile/assets/message-menu/cindy-undo-2.imageset/cindy-undo-2.png b/apps/mobile/assets/message-menu/cindy-undo-2.imageset/cindy-undo-2.png
new file mode 100644
index 0000000000..f31b83e7be
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-undo-2.imageset/cindy-undo-2.png differ
diff --git a/apps/mobile/assets/message-menu/cindy-undo-2.imageset/[email protected] b/apps/mobile/assets/message-menu/cindy-undo-2.imageset/[email protected]
new file mode 100644
index 0000000000..441190360c
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-undo-2.imageset/[email protected] differ
diff --git a/apps/mobile/assets/message-menu/cindy-undo-2.imageset/[email protected] b/apps/mobile/assets/message-menu/cindy-undo-2.imageset/[email protected]
new file mode 100644
index 0000000000..50c6211769
Binary files /dev/null and b/apps/mobile/assets/message-menu/cindy-undo-2.imageset/[email protected] differ
diff --git a/apps/mobile/assets/message-menu/cindy-undo-2.svg b/apps/mobile/assets/message-menu/cindy-undo-2.svg
new file mode 100644
index 0000000000..c01e62c876
--- /dev/null
+++ b/apps/mobile/assets/message-menu/cindy-undo-2.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-undo2"><path d="M9 14 4 9l5-5"></path><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"></path></svg>
diff --git a/apps/mobile/fingerprint.config.cjs b/apps/mobile/fingerprint.config.cjs
index 5067bd1644..9d288c92b0 100644
--- a/apps/mobile/fingerprint.config.cjs
+++ b/apps/mobile/fingerprint.config.cjs
@@ -17,6 +17,17 @@ const sourceSkips = [
module.exports = {
sourceSkips,
+ // These images are compiled into the native catalog, not delivered by Metro.
+ extraSources: [
+ 'cindy-message-square-plus',
+ 'cindy-link-2',
+ 'cindy-undo-2',
+ 'cindy-trash-2',
+ ].map((name) => ({
+ type: 'dir',
+ filePath: `assets/message-menu/${name}.imageset`,
+ reasons: ['native message menu assets'],
+ })),
fileHookTransform(source, chunk, isEndOfFile) {
if (source.type !== 'file' || source.filePath !== 'eas.json') {
return chunk;
diff --git a/apps/mobile/plugins/with-message-menu-icons.js b/apps/mobile/plugins/with-message-menu-icons.js
new file mode 100644
index 0000000000..eeaec19c96
--- /dev/null
+++ b/apps/mobile/plugins/with-message-menu-icons.js
@@ -0,0 +1,31 @@
+const fs = require("node:fs");
+const path = require("node:path");
+const { withDangerousMod, IOSConfig } = require("@expo/config-plugins");
+
+// UIImage(named:) resolves these assets for the existing native UIMenu bridge.
+function withMessageMenuIcons(config) {
+ return withDangerousMod(config, [
+ "ios",
+ async (mod) => {
+ const projectRoot = mod.modRequest.projectRoot;
+ const projectName = IOSConfig.XcodeUtils.getProjectName(projectRoot);
+ const source = path.join(projectRoot, "assets", "message-menu");
+ const destination = path.join(
+ mod.modRequest.platformProjectRoot,
+ projectName,
+ "Images.xcassets",
+ );
+ for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
+ if (!entry.isDirectory() || !entry.name.endsWith(".imageset")) continue;
+ fs.cpSync(
+ path.join(source, entry.name),
+ path.join(destination, entry.name),
+ { recursive: true },
+ );
+ }
+ return mod;
+ },
+ ]);
+}
+
+module.exports = withMessageMenuIcons;
diff --git a/apps/mobile/src/__tests__/messageActionMenu.test.ts b/apps/mobile/src/__tests__/messageActionMenu.test.ts
index ac91a7b8c3..e632e55c60 100644
--- a/apps/mobile/src/__tests__/messageActionMenu.test.ts
+++ b/apps/mobile/src/__tests__/messageActionMenu.test.ts
@@ -3,6 +3,7 @@ import { resolve } from 'node:path';
import { beforeAll, describe, expect, it } from 'vitest';
import { i18n } from '@/i18n';
import { buildMobileMessageMenu } from '@/session/messageActionMenu';
+import { iconSize } from '@/theme/tokens';
// 文案已 i18n 化;固定 zh-CN 让字面量断言与语言环境解耦(全局 mock 默认 en-US)。
beforeAll(async () => {
@@ -17,13 +18,36 @@ describe('mobile message action menu', () => {
canDelete: true,
canRewind: true,
})).toEqual([
- { id: 'add-to-chat', label: '添加到对话' },
- { id: 'copy-link', label: '复制当前消息链接' },
- { id: 'rewind', label: '回到此处' },
- { id: 'delete', label: '删除本条消息', destructive: true, separatorBefore: true },
+ { id: 'add-to-chat', label: '添加到对话', image: 'cindy-message-square-plus' },
+ { id: 'copy-link', label: '复制当前消息链接', image: 'cindy-link-2' },
+ { id: 'rewind', label: '回到此处', image: 'cindy-undo-2' },
+ { id: 'delete', label: '删除本条消息', image: 'cindy-trash-2', destructive: true, separatorBefore: true },
]);
});
+ it('ships each native menu image as a template at every iOS scale', () => {
+ const items = buildMobileMessageMenu({ canAddToChat: true, canCopyLink: true, canDelete: true, canRewind: true });
+ for (const item of items) {
+ const directory = resolve(process.cwd(), 'assets/message-menu', `${item.image}.imageset`);
+ const fingerprintConfig = require('../../fingerprint.config.cjs');
+ expect(fingerprintConfig.extraSources).toContainEqual({
+ type: 'dir',
+ filePath: `assets/message-menu/${item.image}.imageset`,
+ reasons: ['native message menu assets'],
+ });
+ const catalog = JSON.parse(readFileSync(resolve(directory, 'Contents.json'), 'utf8'));
+ expect(catalog.properties['template-rendering-intent']).toBe('template');
+ expect(catalog.images.map((image: { scale: string }) => image.scale)).toEqual(['1x', '2x', '3x']);
+ for (const image of catalog.images) {
+ const png = readFileSync(resolve(directory, image.filename));
+ const size = iconSize.lg * Number.parseInt(image.scale, 10);
+ expect(png.subarray(1, 4).toString()).toBe('PNG');
+ expect(png.readUInt32BE(16)).toBe(size);
+ expect(png.readUInt32BE(20)).toBe(size);
+ }
+ }
+ });
+
it('reuses the shared sheet lifecycle and dispatches a choice after close', () => {
const source = readFileSync(resolve(process.cwd(), 'src/session/MessageActionSheet.tsx'), 'utf8');
expect(source).toContain('<SheetModal');
diff --git a/apps/mobile/src/__tests__/nativePullDownMenu.test.tsx b/apps/mobile/src/__tests__/nativePullDownMenu.test.tsx
new file mode 100644
index 0000000000..1403af01c6
--- /dev/null
+++ b/apps/mobile/src/__tests__/nativePullDownMenu.test.tsx
@@ -0,0 +1,75 @@
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import type { MenuAction } from "@react-native-menu/menu";
+import { describe, expect, it, vi } from "vitest";
+import { NativePullDownMenu } from "@/platform/chrome/NativePullDownMenu";
+import { palettes } from "@/theme/tokens";
+
+const native = vi.hoisted(() => ({
+ mode: "light" as "light" | "dark",
+ actions: [] as MenuAction[],
+}));
+vi.mock("react-native", () => ({
+ Platform: { OS: "ios" },
+ NativeModules: {},
+ UIManager: { getViewManagerConfig: () => ({}) },
+}));
+vi.mock("@/theme", async () => {
+ const { palettes } = await import("@/theme/tokens");
+ return { useTheme: () => ({ colors: palettes[native.mode] }) };
+});
+vi.mock("@react-native-menu/menu", () => ({
+ MenuView: ({ actions }: { actions: MenuAction[] }) => {
+ native.actions = actions;
+ return null;
+ },
+}));
+
+describe("native menu symbol colors", () => {
+ it.each(["light", "dark"] as const)(
+ "supplies visible colors to Fabric in %s mode",
+ (mode) => {
+ native.mode = mode;
+ renderToStaticMarkup(
+ createElement(NativePullDownMenu, {
+ actions: [
+ { id: "copy", title: "Copy", image: "link" },
+ {
+ id: "delete",
+ title: "Delete",
+ image: "trash",
+ destructive: true,
+ disabled: true,
+ },
+ {
+ id: "more",
+ title: "More",
+ subactions: [
+ {
+ id: "rewind",
+ title: "Rewind",
+ image: "arrow.uturn.backward",
+ },
+ ],
+ },
+ ],
+ children: null,
+ onAction: vi.fn(),
+ }),
+ );
+ expect(native.actions[0]).toMatchObject({
+ image: "link",
+ imageColor: palettes[mode].textPrimary,
+ });
+ expect(native.actions[1]).toMatchObject({
+ image: "trash",
+ imageColor: palettes[mode].destructive,
+ attributes: { destructive: true, disabled: true },
+ });
+ expect(native.actions[2].subactions?.[0]).toMatchObject({
+ image: "arrow.uturn.backward",
+ imageColor: palettes[mode].textPrimary,
+ });
+ },
+ );
+});
diff --git a/apps/mobile/src/platform/chrome/NativePullDownMenu.tsx b/apps/mobile/src/platform/chrome/NativePullDownMenu.tsx
index 56dd9c426f..7a8491e777 100644
--- a/apps/mobile/src/platform/chrome/NativePullDownMenu.tsx
+++ b/apps/mobile/src/platform/chrome/NativePullDownMenu.tsx
@@ -1,12 +1,14 @@
import { MenuView, type MenuAction } from "@react-native-menu/menu";
import { type ReactNode } from "react";
import { NativeModules, Platform, UIManager } from "react-native";
+import { useTheme, type ThemeColors } from "@/theme";
export type NativePullDownAction = {
disabled?: boolean;
destructive?: boolean;
displayInline?: boolean;
id: string;
+ image?: MenuAction["image"];
keepPresented?: boolean;
preferredElementSize?: "small" | "medium" | "large";
state?: "on" | "off" | "mixed";
@@ -26,10 +28,23 @@ export function usesNativePullDownMenu(): boolean {
return nativePullDownAvailable;
}
-function toMenuAction(action: NativePullDownAction): MenuAction {
+function toMenuAction(
+ action: NativePullDownAction,
+ colors: ThemeColors,
+): MenuAction {
return {
id: action.id,
title: action.title,
+ // Fabric defaults the library's optional Int32 imageColor to transparent.
+ // Always pair a symbol with a visible semantic color.
+ ...(action.image
+ ? {
+ image: action.image,
+ imageColor: action.destructive
+ ? colors.destructive
+ : colors.textPrimary,
+ }
+ : {}),
...(action.subtitle ? { subtitle: action.subtitle } : {}),
...(action.state ? { state: action.state } : {}),
...(action.displayInline ? { displayInline: true } : {}),
@@ -46,7 +61,11 @@ function toMenuAction(action: NativePullDownAction): MenuAction {
}
: {}),
...(action.subactions?.length
- ? { subactions: action.subactions.map(toMenuAction) }
+ ? {
+ subactions: action.subactions.map((item) =>
+ toMenuAction(item, colors),
+ ),
+ }
: {}),
};
}
@@ -68,10 +87,11 @@ export function NativePullDownMenu({
onAction(id: string): void;
testID?: string;
}) {
+ const { colors } = useTheme();
if (!usesNativePullDownMenu()) return children;
return (
<MenuView
- actions={actions.map(toMenuAction)}
+ actions={actions.map((action) => toMenuAction(action, colors))}
onPressAction={({ nativeEvent }) => {
if (nativeEvent.event) onAction(nativeEvent.event);
}}
diff --git a/apps/mobile/src/session/MessageRenderer.tsx b/apps/mobile/src/session/MessageRenderer.tsx
index aa1ef67854..858e0dc4b6 100644
--- a/apps/mobile/src/session/MessageRenderer.tsx
+++ b/apps/mobile/src/session/MessageRenderer.tsx
@@ -3426,6 +3426,7 @@ function MessageBubble({
return (
<NativePullDownMenu
actions={messageMenu.map((item) => ({
+ image: item.image,
destructive: item.destructive,
disabled: actionBusy && (item.id === 'rewind' || item.id === 'delete'),
id: item.id,
diff --git a/apps/mobile/src/session/messageActionMenu.ts b/apps/mobile/src/session/messageActionMenu.ts
index 378607798b..b20776b303 100644
--- a/apps/mobile/src/session/messageActionMenu.ts
+++ b/apps/mobile/src/session/messageActionMenu.ts
@@ -12,6 +12,8 @@ export type MobileMessageMenuActionId = 'add-to-chat' | 'copy-link' | 'rewind' |
export interface MobileMessageMenuItem {
id: MobileMessageMenuActionId;
label: string;
+ /** Bundled desktop Lucide artwork used by the iOS native pull-down menu. */
+ image: string;
destructive?: boolean;
separatorBefore?: boolean;
}
@@ -28,16 +30,17 @@ export function buildMobileMessageMenu(input: {
// delete 删的是单条消息。
// 「添加到对话」指发进当前对话流,按 naming 规则保持「对话」。
if (input.canAddToChat) {
- items.push({ id: 'add-to-chat', label: i18n.t('session.messageMenu.addToChat') });
+ items.push({ id: 'add-to-chat', label: i18n.t('session.messageMenu.addToChat'), image: 'cindy-message-square-plus' });
}
if (input.canCopyLink) {
- items.push({ id: 'copy-link', label: i18n.t('session.messageMenu.copyLink') });
+ items.push({ id: 'copy-link', label: i18n.t('session.messageMenu.copyLink'), image: 'cindy-link-2' });
}
- if (input.canRewind) items.push({ id: 'rewind', label: i18n.t('session.messageMenu.rewind') });
+ if (input.canRewind) items.push({ id: 'rewind', label: i18n.t('session.messageMenu.rewind'), image: 'cindy-undo-2' });
if (input.canDelete) {
items.push({
id: 'delete',
label: i18n.t('session.messageMenu.deleteOne'),
+ image: 'cindy-trash-2',
destructive: true,
separatorBefore: items.length > 0,
});
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index f31903ffd8..457c009b55 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -1364,7 +1364,9 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the
#### Iconography
- Session leading agent icons follow runtime identity: the Claude Code official pixel face / the Codex CLI `>_` multi-petal mark; desktop (`VendorIcon`) and mobile (`MobileVendorIcon`) share source assets (finalized 2026-07-20). Agent identity marks must not be mixed with Anthropic / OpenAI provider or model brand marks; `BrandArrow` is reserved for brand decoration.
-- Model selection renders by model brand. Brand icons already replaced on desktop are reused on mobile from the same source; everything else uses semantically equivalent lucide glyphs.
+- Model selection renders by model brand. Brand icons already replaced on desktop are reused on mobile from the same source.
+- **Cross-platform action icons must match exactly (2026-09-08 owner ruling):** the same action on desktop and mobile uses the same source glyph and stroke geometry. For Lucide icons, use the same named glyph from `lucide-react` / `lucide-react-native`; a semantically similar SF Symbol or another icon family is not an equivalent replacement. Platform-appropriate size and semantic Light/Dark colors may differ, but the icon artwork must remain identical. This applies to native menus as well as custom components. Message menu baseline: `MessageSquarePlus` (add to chat), `Link2` (copy message link), `Undo2` (rewind), `Trash2` (delete message). If a native component cannot display the shared artwork, resolve the rendering approach explicitly instead of silently substituting a system symbol.
+- **Mobile action-menu icon sizing (2026-09-08 owner ruling):** message, session, and file action menus use `iconSize.lg` (18 pt) and `iconStroke.regular` (2 in Lucide's 24-unit viewBox). Native menu assets follow the same logical size: 18 / 36 / 54 px at 1x / 2x / 3x; a 24-unit SVG viewBox does not imply a 24 pt display size. Keep the shared glyph geometry and scale the whole artwork. Existing compact filter/navigation menus may retain `iconSize.md` (16); `iconSize.action` (20) is the toolbar/lightbox tier, not the action-menu default. Preserve native menu row layout and touch targets when sizing the glyph.
- Send semantics use the filled paper plane `Send`, colored by the neutral-inverse CTA tokens; never a red send button or icon for ordinary send.
#### Type & layout
diff --git a/docs/design-rules/design-decision-log.md b/docs/design-rules/design-decision-log.md
index 5ee6ec3683..ce29db22d3 100644
--- a/docs/design-rules/design-decision-log.md
+++ b/docs/design-rules/design-decision-log.md
@@ -12,6 +12,10 @@
## 2026-09
+- **09-08** **手机版操作菜单图标统一为 18 pt**——用户对照现有手机版菜单后确认「好的,统一一下,并且作为以后的规范」。消息、任务、文件操作菜单以 `iconSize.lg = 18`、`iconStroke.regular = 2` 为基线;原生菜单资源按 18 / 36 / 54 px 输出,保留桌面同名 Lucide 的 24-unit viewBox 与笔画几何。替代本次恢复图标时误选的 24 pt,以及尚未实施的 20 pt 建议。既有紧凑筛选/导航菜单的 16 档、工具栏/lightbox 的 20 档保留各自用途,不全局改尺寸。落点:`DESIGN.md §15.13 Iconography` 与消息菜单资源尺寸校验;本条记录规范裁决,不代表用户已验收最终画面。
+
+- **09-08** **同一操作的双端图标必须完全一致**——用户在手机版消息菜单图标恢复过程中明确要求「图标需要和桌面版的完全一致。这个设计原则你也要记录一下」。裁决:同一操作复用相同来源的图形与笔画几何,Lucide 使用同名 glyph,不以语义相近的 SF Symbols 替代;尺寸可适配平台,颜色继续走 Light/Dark 语义 token。消息菜单对应 `MessageSquarePlus` / `Link2` / `Undo2` / `Trash2`。本条替代原先只要求普通图标「语义等价」的宽松口径,落点为 `DESIGN.md §15.13 Iconography`;记录裁决不代表实现或实机验收已完成。
+
- **09-07** **圆角体系改为「可见层 + 登记驱动」,新增 data mark 类目**——
**决策依据:** 项目所有者授权本轮采用独立评审定案;条款由 AI 整理。授权记录:项目所有者 kirozeng 以 [PR #4072](https://github.com/makecindy/cindy/pull/4072) 作者身份提交并全程推进本裁决(PR 描述载明「按所有者已定案方案;所有者 2026-09-07 圆角裁决」);2026-09-08 所有者指示补记本条并解除全部合并阻塞。PR 作者身份、描述原文与所有者本人执行的合并操作互为可核验佐证。**本条确定规范目标,不表示实现已完成或视觉验收已通过。**
**背景:同一缺陷两次发作。** ①PR #3802(09-03 合入)给用量历史热力图与每日 token 柱图加日期点击,为可点击把图元包成 `<button>`;自动 review 据 §5「every button is a pill」连提两轮 P1,作者依次给外层按钮、再给实际可见的彩色内层加 `rounded-full`,方格变圆点、柱变胶囊;另一条 24×24 命中区 P2 促使热力图 `cellSize` 12→24、柱图容器最小宽度撑到 807px 并横向滚动。#3802 记录了筛选与点击的手工验证,但缺少可复核的完整视觉验收证据,**不能据此推断无人看过界面**。②PR #4001(09-06 合入)将快捷键外框登记为 4px 特例,但保留了与之冲突的「三档且仅此三档」和「唯一豁免」措辞。